private void DeserializeLevel() { //Lord have mercy foreach (WavesScriptableObject wave in levelScriptableObject.waves) { Wave tempWave = new Wave(); List <MiniWave> miniWaves = new List <MiniWave>(); foreach (MiniWavesScriptableObject miniWave in wave.wave) { List <EnemyInWave> enemyList = new List <EnemyInWave>(); foreach (EnemyInWave enemy in miniWave.miniWave.enemiesInMiniWave) { enemyList.Add(enemy); } MiniWave tempMiniWave = new MiniWave { enemiesInMiniWave = enemyList, delay = miniWave.miniWave.delay }; miniWaves.Add(tempMiniWave); } tempWave.miniWaves = miniWaves; level.waves.Add(tempWave); } }
private static void SpawnMiniWave(PositionedObjectList <SpawnPoint> spawnPoints, MiniWave miniWave) { // make the same spawn point used for all enemies on this subwave... var spawnPoint = FlatRedBallServices.Random.In(spawnPoints); for (int i = 0; i < miniWave.Spawns.Count; i++) { var data = miniWave.Spawns[i]; //... unles sit's a multispawn if (miniWave.CanSpawnAtMultipleSpots) { spawnPoint = FlatRedBallServices.Random.In(spawnPoints); } float x = spawnPoint.X; float y = spawnPoint.Y; if (i == 0) { // do it now! var enemy = Factories.EnemyFactory.CreateNew(x, y); enemy.CurrentDataCategoryState = data; } else { spawnPoint.Call(() => { var enemy = Factories.EnemyFactory.CreateNew(x, y); enemy.CurrentDataCategoryState = data; }).After(i * SpawnPoint.SecondsBetweenEachEnemyInMiniWave); } } }