// Update is called once per frame void Update() { timer += Time.deltaTime; if (setDestruct) { destroyTimer -= Time.deltaTime; if (destroyTimer < 0) { Destroy(this.gameObject); } } else if (timer > fireInterval) { shotAngle = (shotAngle + 10) % 360; Vector3 shotVector = new Vector3(Mathf.Cos((float)shotAngle * Mathf.PI / 180), 0, Mathf.Sin((float)shotAngle * Mathf.PI / 180)); BlastController blast = Instantiate(shot, transform.position + shotVector, Quaternion.identity).GetComponent <BlastController> () as BlastController; blast.setDir(shotVector); timer = 0f; } }