private IEnumerator SpawnAllEnemiesInWave(WaveConfiguration waveConfiguration) { for (int enemyCount = 0; enemyCount < waveConfiguration.GetNumberEnemies(); enemyCount++) { GameObject newEnemy = Instantiate(waveConfiguration.GetEnemyPrefab(), waveConfiguration.GetWayPoints()[0].transform.position, Quaternion.identity); newEnemy.GetComponent <EnemyFollowPath>().SetWaveConfig(waveConfiguration); yield return(new WaitForSeconds(waveConfiguration.GetTimeBeetweenSpaws())); } }