//Set up stage and configure each wave in the stage //using the wave manager public StageConfig ConfigureStage(Dictionary <string, WaveConfig> jsonStages, string stage) { //Reset game //Despawn all enemies/bullets from last stage //Grab the waves in the stage, which is a list of enemy configurations WaveConfig waveConfigs = jsonStages[stage]; List <Wave> waves = new List <Wave>(); //For each set of enemies in a wave for (int i = 0; i < waveConfigs.waves.Count; ++i) { //Tell wave manager to configure the wave //Pass it the enemy info waves.Add(_waveManager.ConfigureWave(waveConfigs, i)); } //Return stage configuration return(new StageConfig(waves)); }
public Wave ConfigureWave(WaveConfig waveConfigs, int index) { //Grab list of enemy configs at index List <EnemyConfig> waveConfig = waveConfigs.waves[index]; List <EnemyConfig> wave = new List <EnemyConfig>(); //For each enemy in the wave for (int i = 0; i < waveConfig.Count; ++i) { //Save enemy config to send to enemy manager EnemyConfig enemy = waveConfig[i]; ////Send to enemy info to the enemy manager to spawn //_enemyManager.Spawn(enemy); //Add enemy config to list of enemies in wave wave.Add(enemy); } //Return new wave config return(new Wave(wave)); }