IEnumerator WaitTimeBetweenEnemies(EnemyWave wave) { for (int i = 0; i < wave.GetEnemiesNumber(); i++) { ChangeEnemySettings(wave.GetEnemyPrefab(), wave); Instantiate(wave.GetEnemyPrefab(), spawnPostion, Quaternion.identity); yield return(new WaitForSeconds(wave.GetTimeBetweenEnemiesSpawns())); } }