public IEnumerator gatler(float startPos = 0, bool direction = true) { float ballNumberInCircle = 20; float sizeUpBy = .03f; float originalSize = 4f; float step; float currentSize; float theta = 2 * Mathf.PI * startPos; //it will relate to the step currentSize = originalSize; while (firing) { if (firing) { ballNumberInCircle = currentSize * 6.66f; step = 2 * Mathf.PI / ballNumberInCircle; Vector3 vect; if (direction) // equals true { vect = new Vector3(0 - currentSize * Mathf.Cos(theta), 0 - currentSize * Mathf.Sin(theta), 0); } else { vect = new Vector3(0 + currentSize * Mathf.Cos(theta), 0 - currentSize * Mathf.Sin(theta), 0); } ballShooter.fireSingleBall(new float3(vect)); theta += step; currentSize += sizeUpBy; } yield return(new WaitForSecondsRealtime(0.01f)); } }
public void fire() { ballShooter.fireSingleBall(); }