// Use this for initialization IEnumerator Start() { while (true) { spaceship = GetComponent <spaceship>(); spaceship.Shoot(transform); GetComponent <AudioSource>().Play(); yield return(new WaitForSeconds(spaceship.shotdelay)); } }
IEnumerator Start() { spaceship = GetComponent <spaceship>(); Move(transform.up * -1); if (!spaceship.canshoot) { yield break; } while (true) { for (int i = 0; i < transform.childCount; i++) { Transform shotpos = transform.GetChild(i); spaceship.Shoot(shotpos); } yield return(new WaitForSeconds(spaceship.shotdelay)); } }