private IEnumerator SpawnAllEnemiesInWave(WaveConfig waveConfig) { for (int i = 0; i < waveConfig.GetNumberOfEnemies(); i++) { var angle = waveType == "Enemy" ? Quaternion.Euler(new Vector3(0, 0, 225)) : Quaternion.identity; var newCharacter = Instantiate(waveConfig.GetCharacterPrefab(), waveConfig.GetWaypoints()[0].transform.position, angle); newCharacter.GetComponent <Pathing>().SetWaveConfig(waveConfig); yield return(new WaitForSeconds(waveConfig.GetTimeBetweenSpawns())); } }