} // IEnumerator SpawnAllWaves() /*** * This coroutine spawns all enemies in a wave. ***/ private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig) { Debug.Log("Starting wave " + waveConfig.name); waveConfig.BuildShips(); for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++) { Debug.Log("Spawning enemy #" + enemyCount + " for " + waveConfig.name); var newEnemy = waveConfig.GetEnemyShip(enemyCount); newEnemy.transform.position = waveConfig.GetWaypoints()[0].transform.position; newEnemy.GetComponent<EnemyPathing>().SetWaveConfig(waveConfig); level.AddEnemy(); yield return new WaitForSeconds(waveConfig.GetTimeBetweenSpawns()); } // for } // IEnumerator SpawnAllEnemiesInWave()