void Start() { EnemyFactoryScript factory = GameObject.FindGameObjectWithTag("Respawn") .GetComponent <EnemyFactoryScript>(); StartCoroutine(GenerateWaves(factory)); StartCoroutine(TimedScore()); }
private IEnumerator GenerateWaves(EnemyFactoryScript factory) { while (!GameOver) { yield return(new WaitForSeconds(WavesTimeout)); Wave += 1; for (int i = 0; i < EnemiesCount; ++i) { factory.GenerateEnemy(); yield return(new WaitForSeconds(EnemiesTimeout)); } } }