using UnityEngine; using System.Collections; using System; public class bulletmanager : MonoBehaviour { public GameObject projectile; private double radius=0.1; private double pointx,pointy; private double angle,angle1,angle2; private Vector3 projposition; private float speed=5; // Use this for initialization void Start () { angle=1; StartCoroutine("drawcircle"); } // Update is called once per frame void Update () { transform.Translate(Vector3.left * speed * Time.deltaTime); } private double DegreeToRadian(double a) { double answer; answer = Math.PI * (a/180.0); return answer; } IEnumerator drawcircle() { for(int i=0;i<360;i+=18) { angle1=Math.Cos(DegreeToRadian(angle+i)); angle2=Math.Sin(DegreeToRadian(angle+i)); pointx=radius*angle1; pointy=radius*angle2; projposition=new Vector3((float)pointx,(float)pointy,0); GameObject bullet = Instantiate(projectile,projposition,Quaternion.identity) as GameObject; } yield return new WaitForSeconds(0.5f); } }