|
@@ -27,10 +27,13 @@ public class MultiShot : SpecialSkills
|
|
|
float angleInterval = num > 1 ? angle / (float)(num - 1) : 0f;
|
|
float angleInterval = num > 1 ? angle / (float)(num - 1) : 0f;
|
|
|
for (int i = 0; i < num; i++)
|
|
for (int i = 0; i < num; i++)
|
|
|
{
|
|
{
|
|
|
- float ang = 0;
|
|
|
|
|
- GameObject obj = Instantiate(arrow);
|
|
|
|
|
- MultiArrowController arrowController = obj.AddComponent<MultiArrowController>();
|
|
|
|
|
- Vector3 dir = Vector3.zero;
|
|
|
|
|
|
|
+ float ang;
|
|
|
|
|
+ GameObject obj = PoolManager.Instantiate(arrow);
|
|
|
|
|
+ MultiArrowController arrowController = obj.GetComponent<MultiArrowController>();
|
|
|
|
|
+ if (arrowController == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ arrowController = obj.AddComponent<MultiArrowController>();
|
|
|
|
|
+ }
|
|
|
if (owner.bodyTrans.localScale.x > 0)
|
|
if (owner.bodyTrans.localScale.x > 0)
|
|
|
{
|
|
{
|
|
|
ang = 180 - arrivalAngle - angle / 2 + i * angleInterval;
|
|
ang = 180 - arrivalAngle - angle / 2 + i * angleInterval;
|
|
@@ -40,7 +43,7 @@ public class MultiShot : SpecialSkills
|
|
|
ang = arrivalAngle - angle / 2 + i * angleInterval;
|
|
ang = arrivalAngle - angle / 2 + i * angleInterval;
|
|
|
}
|
|
}
|
|
|
ang = ang / 180 * Mathf.PI;
|
|
ang = ang / 180 * Mathf.PI;
|
|
|
- dir = new Vector3(Mathf.Cos(ang), Mathf.Sin(ang), 0);
|
|
|
|
|
|
|
+ Vector3 dir = new Vector3(Mathf.Cos(ang), Mathf.Sin(ang), 0);
|
|
|
obj.GetComponent<Bullet>().BeShoot(owner, owner.transform.position + Vector3.up, dir, false);
|
|
obj.GetComponent<Bullet>().BeShoot(owner, owner.transform.position + Vector3.up, dir, false);
|
|
|
arrowController.Initialize(gravity, speed);
|
|
arrowController.Initialize(gravity, speed);
|
|
|
}
|
|
}
|