Esempio n. 1
0
 private IEnumerator SpawnAllEnemies(WaveConfiguration waveConfig) /* coroutine
                                                                    * that spawns enemies in a wave configuration */
 {
     for (int enemyCount = 0; enemyCount < waveConfig.GetNumberOfEnemies(); enemyCount++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPathing>().SetWaveConfiguration(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetSpawnTime()));
     }
 }