private void OnEntityAdded(object sender, Creep creep) { if (!creep.IsValid || creep.Team == myTeam || creep.UnitType != 1152) { 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 AddCreepWaves() { foreach (var wave in Waves) { CreepWaves.Add(new CreepWave(wave)); } WaveGenerator = new WaveGenerator(CreepWaves); }