private IEnumerator SpawnAllEnemiesInWave(WaveConfig wc) { GameObject enemyPrefab = wc.GetEnemy(); enemyPrefab.GetComponent <Enemy>() .SetEnemyParams(wc.GetHP(), wc.GetMinFireRate(), wc.GetMaxFireRate(), wc.GetWayPoint(), wc.GetMoveSpeed()); for (int i = 0; i < wc.GetEnemyCount(); i++) { GameObject enemy = Instantiate(enemyPrefab, enemyPrefab.transform.position, Quaternion.identity); yield return(new WaitForSeconds(wc.GetSpawnTime())); } }