// Put a delay between waves spawning
 private IEnumerator DelayBetweenWaves(WaveConfigurations currentWave)
 {
     StartCoroutine(SpawnAllEnemies(currentWave));
     // Wait for all enemies to appear, then add delay
     yield return(new WaitForSeconds(delayBetweenWaves +
                                     currentWave.GetQuantityOfEnemies() *
                                     currentWave.GetPeriodBetweenSpawning()));
 }
 // For spawning all waves
 private IEnumerator SpawnAllWaves()
 {
     // Iterating through waves and activating coroutine
     for (int waveIndex = startWave; waveIndex < waveConfigurations.Count; waveIndex++)
     {
         WaveConfigurations currentWave = waveConfigurations[waveIndex];
         yield return(DelayBetweenWaves(currentWave));
     }
 }
 // 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()));
     }
 }
 // Setter for Wave Configuration
 public void SetWaveConfig(WaveConfigurations waveConfig)
 {
     waveConfigurations = waveConfig;
 }