private void WaveCountdown(double deltaTime) { waveCountdown = true; waveSpawnTimer -= deltaTime; if (waveSpawnTimer <= 0) { if (!firstWaveFinished) { currentCreepWave = CreepWave.Militia; firstWave = true; waveCountdown = false; } else if (!secondWaveFinished) { currentCreepWave = CreepWave.Warrior; secondWave = true; waveCountdown = false; } else if (!thirdWaveFinished) { currentCreepWave = CreepWave.Knight; thirdWave = true; waveCountdown = false; } waveSpawnTimer = waveSpawnTimerReset; } }
public void SpawnWave(CreepWave wave) { _wave = wave; ResetTimers(); CreateSpawnTimeLine(); _shouldSpawn = true; }
private void OnEntityAdded(object sender, Creep creep) { if (!creep.IsValid || creep.Team == myTeam || creep.ClassId != ClassId.CDOTA_BaseNPC_Creep_Lane && creep.ClassId != ClassId.CDOTA_BaseNPC_Creep_Siege) { return; } var wave = CreepWaves.FirstOrDefault(x => !x.IsSpawned && x.Creeps.Any(z => z.Distance2D(creep) < 300)); if (wave != null) { wave.Creeps.Add(creep); } else { var laneData = lanePaths.GetLaneData(creep.Position); if (laneData == null) { return; } var newWave = new CreepWave(laneData.Value, creep.Team); newWave.Creeps.Add(creep); CreepWaves.Add(newWave); } }
private void CreateWave(double deltaTime, Creep creep, Creep boss) { if (waveCount <= 9) { creepSpawnInterval -= deltaTime; if (waveCount <= 7 && creepSpawnInterval <= 0) { creepWave.Add(creep); creepSpawnInterval = creepSpawnIntervalReset; waveCount += 1; } else if (waveCount >= 8 && creepSpawnInterval <= 0) { creepWave.Add(boss); creepSpawnInterval = creepSpawnIntervalReset; waveCount += 1; } } if (waveCount == 10 && creepWave.Count == 0) { currentCreepWave = CreepWave.Countdown; waveCount = 0; waveEnded = true; } }
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 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 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 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); }
public void CheckForGroupPpPl() { creepWave = new CreepWave(5.0f, 1.0f, "GroupPpPl", "GroupPpPl"); 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.Plastic, group.CreepList[1]); } }
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 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); }
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 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); }
private void CreateWave(double deltaTime, Creep creep, Creep boss) { if(waveCount <=9) { creepSpawnInterval -= deltaTime; if (waveCount <= 7 && creepSpawnInterval <= 0) { creepWave.Add(creep); creepSpawnInterval = creepSpawnIntervalReset; waveCount += 1; } else if (waveCount >= 8 && creepSpawnInterval <= 0) { creepWave.Add(boss); creepSpawnInterval = creepSpawnIntervalReset; waveCount += 1; } } if (waveCount == 10 && creepWave.Count == 0) { currentCreepWave = CreepWave.Countdown; waveCount = 0; waveEnded = true; } }
public static void AddCreepWaveToWaveGenerator(this GameLevel gameLevel, CreepWave wave) { gameLevel.WaveGenerator.waveList.Add(wave); gameLevel.WaveGenerator.UpdateTotalCreepCountForLevel(); gameLevel.UpdateWave(); }
public override void Initialize() { base.Initialize(); creepWave = new CreepWave(5.0f, 1.0f, "Cloth, Iron, Paper, Wood, Glass, Sand, Plastic", "CreepWave"); }