// For spawning all enemies in current wave
 private IEnumerator SpawnAllEnemies(WaveConfigurations waveConfig)
 {
     // i corresponds to enemy count
     for (int i = 0; i < waveConfig.GetQuantityOfEnemies(); i++)
     {
         // Creating enemies and spawning after specified delay
         GameObject newEnemy = Instantiate(waveConfig.GetEnemyPrefab(),
                                           waveConfig.GetWaypoints()[0].transform.position,
                                           Quaternion.identity);
         newEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GetPeriodBetweenSpawning()));
     }
 }
Esempio n. 2
0
 // Start is called before the first frame update
 void Start()
 {
     // Get the relevant waypoints from Wave Config
     wayPoints          = waveConfigurations.GetWaypoints();
     transform.position = wayPoints[wayPointIndex].position;
 }