public void NoCreepsSpawnedIfCreepListIsEmpty() { var waveA = new CreepWave(0.0f, 1.0f); var waves = new List<CreepWave> { waveA }; new WaveGenerator(waves, Vector3D.One); Assert.AreEqual(0, EntitiesRunner.Current.GetEntitiesOfType<Creep>().Count); }
public void CreepWaveDataCreationFromWave() { var wave = new Wave(5.0f, 1.0f, "Cloth, Iron, Paper, Wood, Glass, Sand, Plastic", "CreepWave"); creepWave = new CreepWave(wave); Assert.AreEqual(5.0f, creepWave.WaitTime); Assert.AreEqual(1.0f, creepWave.SpawnInterval); Assert.AreEqual(7, creepWave.CreepsAndGroupsList.Count); }
public void FirstItemInWaveListHasWaveWaitTimeAddedToItsSpawnInterval() { var waveA = new CreepWave(0.05f, 0.05f, "Paper, Squad, Paper", "CreepWave"); waveList = new List<CreepWave> { waveA }; new WaveGenerator(waveList, Vector3D.One); AdvanceTimeAndUpdateEntities(5.0f); Assert.AreEqual(2, EntitiesRunner.Current.GetEntitiesOfType<Creep>().Count); }
public override void Initialize() { base.Initialize(); var waveA = new CreepWave(1.0f, 1.0f, "Paper, Paper, Paper, Paper, Cloth, Cloth", "CreepWave"); waveList = new List<CreepWave> { waveA }; ContentLoader.Load<GameLevel>("DummyLevelInfo"); new Player(); }
public void CheckForGroupMix() { creepWave = new CreepWave(5.0f, 1.0f, "GroupPpCl", "PaperCloth"); if (creepWave.CreepsAndGroupsList[0].GetType() == typeof(GroupData)) { var group = (GroupData)creepWave.CreepsAndGroupsList[0]; Assert.AreEqual(2, group.CreepList.Count); Assert.AreEqual(CreepType.Paper, group.CreepList[0]); Assert.AreEqual(CreepType.Cloth, group.CreepList[1]); } }
public void CheckForGroupGarbage() { creepWave = new CreepWave(5.0f, 1.0f, "Plastic2", "Plastic3"); if (creepWave.CreepsAndGroupsList[0].GetType() == typeof(GroupData)) { var group = (GroupData)creepWave.CreepsAndGroupsList[0]; Assert.AreEqual(2, group.CreepList.Count); Assert.AreEqual(CreepType.Plastic, group.CreepList[0]); Assert.AreEqual(CreepType.Plastic, group.CreepList[1]); } }
public void CheckForGroupSquad() { creepWave = new CreepWave(5.0f, 1.0f, "Paper3", "Paper3"); if (creepWave.CreepsAndGroupsList[0].GetType() == typeof(GroupData)) { var group = (GroupData)creepWave.CreepsAndGroupsList[0]; Assert.AreEqual(3, group.CreepList.Count); Assert.AreEqual(CreepType.Paper, group.CreepList[0]); Assert.AreEqual(CreepType.Paper, group.CreepList[1]); Assert.AreEqual(CreepType.Paper, group.CreepList[2]); } }
private static void CreateWave(CreepWave wave, WaveGenerator waveGenerator) { if (creepCountForCurrentWave >= wave.TotalCreepsInWave) { creepCountForCurrentWave = 0; waveGenerator.waveList.RemoveAt(0); waveGenerator.level.UpdateWave(); return; } if (!Time.CheckEvery(wave.SpawnInterval)) return; SpawnNextItemFromList(wave.CreepsAndGroupsList[0], waveGenerator); }
private static void CreateWave(CreepWave wave, WaveGenerator waveGenerator) { if (creepCountForCurrentWave >= wave.TotalCreepsInWave) { creepCountForCurrentWave = 0; waveGenerator.waveList.RemoveAt(0); waveGenerator.level.UpdateWave(); return; } if (!Time.CheckEvery(wave.SpawnInterval)) { return; } SpawnNextItemFromList(wave.CreepsAndGroupsList[0], waveGenerator); }
public static void AddCreepWaveToWaveGenerator(this GameLevel gameLevel, CreepWave wave) { gameLevel.WaveGenerator.waveList.Add(wave); gameLevel.WaveGenerator.UpdateTotalCreepCountForLevel(); gameLevel.UpdateWave(); }
public void CheckTotalCreepCountForAWave() { var waveA = new CreepWave(5.0f, 1.0f, "Cloth, Iron, Paper, Wood, Glass, Sand, Plastic", "MixWave1"); Assert.AreEqual(7, waveA.TotalCreepsInWave); var waveB = new CreepWave(5.0f, 1.0f, "Cloth, Iron, Paper, Paper2", "MixWave2"); Assert.AreEqual(5, waveB.TotalCreepsInWave); var waveC = new CreepWave(5.0f, 1.0f, "GroupPpPl, GroupPpCl, GroupClPl, Plastic3, Cloth3, Paper3, Cloth2", "MixWave3"); Assert.AreEqual(17, waveC.TotalCreepsInWave); }
public override void Initialize() { base.Initialize(); creepWave = new CreepWave(5.0f, 1.0f, "Cloth, Iron, Paper, Wood, Glass, Sand, Plastic", "CreepWave"); }
public void NextWaveIsSpawnedOnlyAfterElapsedTimeIsOver() { var waveA = new CreepWave(0.1f, 0.1f, "Paper, Paper", "PaperWave"); var waveB = new CreepWave(0.3f, 0.1f, "Wood", "WoodWave"); new WaveGenerator(new List<CreepWave> { waveA, waveB }, Vector3D.One); AdvanceTimeAndUpdateEntities(0.1f); Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Creep>().Count); AdvanceTimeAndUpdateEntities(0.1f); Assert.AreEqual(2, EntitiesRunner.Current.GetEntitiesOfType<Creep>().Count); AdvanceTimeAndUpdateEntities(0.4f); Assert.AreEqual(3, EntitiesRunner.Current.GetEntitiesOfType<Creep>().Count); }
public void NextCreepIsSpawnedOnlyAfterCreepSpawnTimeInterval() { if (!IsMockResolver) return; var waveA = new CreepWave(1.0f, 1.0f, "Paper, Paper", "PaperWave"); new WaveGenerator(new List<CreepWave> { waveA }, Vector3D.One); AdvanceTimeAndUpdateEntities(1.01f); Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Creep>().Count); AdvanceTimeAndUpdateEntities(0.1f); Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Creep>().Count); }
public void TestTheTotalOfNumberOfCreepsInLevel() { var waveA = new CreepWave(1.0f, 1.0f, "Paper, Paper", "PaperWave"); var generator = new WaveGenerator(new List<CreepWave> { waveA }, Vector3D.One); AdvanceTimeAndUpdateEntities(1.01f); AdvanceTimeAndUpdateEntities(0.1f); Assert.AreEqual(2, generator.TotalCreepsInLevel); }