private void OnEnable() { if (AllEnemies == null) { AllEnemies = new List <EnemyUnit>(); } AllEnemies.Add(this); WorldManager.Instance.EnemiesSpawned++; }
/// <summary> /// Creates a new bosses and minions /// </summary> /// <param name="lvl"> The current level number </param> private void CreateNewEnemies(int lvl) { // Linearly finds the maximum of minions int maxMinions = (int)(-0.1f * lvl + 6); // Linearly finds the maximum of bosses int maxBosses = (int)(0.5f * lvl); // Maximum amount of Minions maxMinions = rnd.Next(maxMinions); // Maximum amount of Minions maxBosses = rnd.Next(maxBosses); // Checks the maximum enemies total int maxEnemiesTotal = Math.Min(maxMinions + maxBosses, (row) * (col) / 2); // Cycles through all the enemies for (int n = 0; n < maxEnemiesTotal; n++) { // Gets a new random position Position pos = GetRandomPosition(); if (maxMinions > 0) { // Adds the new minion to the list AllEnemies.Add(new Minion(Room, Player, pos)); // Puts it on the board Room[pos] = Piece.Enemy; // Decrements one from maxMinions maxMinions--; } else if (maxBosses > 0) { // Adds the new Boss to the list AllEnemies.Add(new Boss(Room, Player, pos)); // Puts it on the board Room[pos] = Piece.Boss; // Decrements one from maxBosses maxBosses--; } } }
protected override void InitBadPixels() { base.InitBadPixels(); // boss boss = new Boss(); Add(boss); for (int i = 0; i < 412; i++) { RedGuard bp = RedGuard.Create(); // Cloaky(); bp.PositionAndTarget = new Vector2(RandomMath.RandomBetween(123f, 720f), RandomMath.RandomBetween(9f, 290f)); //bp.TargetSpeed = 18.0f; // TODO Add(bp); AllEnemies.Add(bp); FindWalkableGround(bp); } for (int i = 0; i < 36; i++) { Servant s = Servant.Create(); s.PositionAndTarget = new Vector2(RandomMath.RandomBetween(140f, 720f), RandomMath.RandomBetween(9f, 290f)); Add(s); FindWalkableGround(s); } // servants at local hero's castle for (int i = 0; i < 3; i++) { Servant s = Servant.Create(); s.AvoidingKnights.ChaseRange = 4f; s.AvoidingHero.ChaseRange = 4f; s.PositionAndTarget = new Vector2(RandomMath.RandomBetween(0f, 20f), RandomMath.RandomBetween(32f, 90f)); Add(s); FindWalkableGround(s); } for (int i = 0; i < 14; i++) // XIV companions! { Knight cp = Knight.Create(); cp.PositionAndTarget = new Vector2(KnightsStartingPositions[2 * i] + DEBUG_SHIFT_POS_RIGHT, KnightsStartingPositions[2 * i + 1]); //bp.TargetSpeed = 18.0f; // TODO Add(cp); hero.Knights.Add(cp); FindWalkableGround(cp); } }
private void GameObject_OnCreate(GameObject sender, EventArgs args) { AllObjects.Add(sender); var hero = sender as AIHeroClient; if (hero != null) { AllHeroes.Add(hero); if (hero.IsEnemy) { EnemyHeroes.Add(hero); AllEnemies.Add(hero); } else { AllyHeroes.Add(hero); AllAllies.Add(hero); } return; } var minion = sender as Obj_AI_Minion; if (minion != null) { if (minion.Team != GameObjectTeam.Neutral) { if (minion.GetMinionType().HasFlag(Extensions.MinionTypes.Ward)) { AllWards.Add(minion); if (minion.IsEnemy) { EnemyWards.Add(minion); } else { AllyWards.Add(minion); } } else { AllMinions.Add(minion); if (minion.IsEnemy) { EnemyMinions.Add(minion); AllEnemies.Add(minion); } else { AllyMinions.Add(minion); AllAllies.Add(minion); } } } else if (minion.Name != "WardCorpse") { switch (minion.GetJungleType()) { case Extensions.JungleType.Small: SmallJungleMinions.Add(minion); break; case Extensions.JungleType.Large: LargeJungleMinions.Add(minion); break; case Extensions.JungleType.Epic: EpicJungleMinions.Add(minion); break; case Extensions.JungleType.Legendary: LegendaryJungleMinions.Add(minion); break; } AllJungleMinions.Add(minion); } return; } var particle = sender as Obj_GeneralParticleEmitter; if (particle != null) { AllParticleEmitters.Add(particle); return; } var turret = sender as Obj_AI_Turret; if (turret != null) { AllTurrets.Add(turret); if (turret.IsEnemy) { EnemyTurrets.Add(turret); } else { AllyTurrets.Add(turret); } return; } var shop = sender as Obj_Shop; if (shop != null) { AllShops.Add(shop); if (shop.IsAlly) { AllyShops.Add(shop); } else { EnemyShops.Add(shop); } return; } var spawnPoint = sender as Obj_SpawnPoint; if (spawnPoint != null) { AllSpawnPoints.Add(spawnPoint); if (spawnPoint.IsAlly) { AllySpawnPoints.Add(spawnPoint); } else { EnemySpawnPoints.Add(spawnPoint); } } var inhibitor = sender as Obj_BarracksDampener; if (inhibitor != null) { AllInhibitors.Add(inhibitor); if (inhibitor.IsAlly) { AllyInhibitors.Add(inhibitor); } else { EnemyInhibitors.Add(inhibitor); } } var nexus = sender as Obj_HQ; if (nexus != null) { AllNexus.Add(nexus); if (nexus.IsAlly) { AllyNexus = nexus; } else { EnemyNexus = nexus; } } var missile = sender as MissileClient; if (missile != null) { AllMissiles.Add(missile); if (missile.IsAlly) { AllyMissiles.Add(missile); } else { EnemyMissiles.Add(missile); } } }