public override void step() { if (destroyable == false) { if (minionState == MinionState.ALIVE) { if (stats.health <= 0) { onDeath(); } else { walk(); remainingDeadSearchTime -= Chronos.deltaTime; if (remainingDeadSearchTime <= 0) // her frame targetSelection yapmayalim. zamani geldiyse sadece. { remainingDeadSearchTime = DEAD_SEARCH_COOLDOWN; // gerekli dead minionlari sec. ICollection <Minion> targets = minionSelector.selectTargetsFromBoard(position.board, getWorldPosition(), int.MaxValue, 0, DEAD_CAPTURE_RANGE, MinionStateSelection.DEAD); if (targets.Count != 0) { List <MutantEightLeggedSpawningMinion> spawnings = new List <MutantEightLeggedSpawningMinion>(targets.Count); foreach (Minion minion in targets) { if (minion is MutantEightLeggedSpawningMinion) { continue; } MutantEightLeggedSpawningMinion fish = createSpawning(game, ownerPlayer); // metod override edildigi icin, upgrade baska spawning olusturuyor minion.position.board.AddMinionSpecificPosition(fish, minion.position.pathPosition, false); // userlara soyleme. spawnings.Add(fish); } Messages.OutgoingMessages.Game.GMinion_MutantEightLegged_spawn.sendMessage( game.players, this, spawnings, targets); foreach (var minion in targets) { minion.onDestroy(); // oluleri yerden temizle. } } } } } else if (minionState == MinionState.DEAD && isReadyToDestroy()) // minionState i tekrar kontrol ettim. ne olur ne olmaz yeni bir state eklersek patlamasin. { onDestroy(); } } }
public override void step() { if (destroyable == false) { if (minionState == MinionState.ALIVE) { if (stats.health <= 0) { onDeath(); } else { walk(); if (remainingSpawnCount > 0) { // gerekli dead minionlari sec. ICollection <Minion> targets = minionSelector.selectTargetsFromBoard(position.board, getWorldPosition(), requiredDeadCount, 0, DEAD_CAPTURE_RANGE, MinionStateSelection.DEAD); foreach (Minion minion in targets) { minion.onDestroy(); // oluleri yerden temizle. } requiredDeadCount -= targets.Count; if (targets.Count != 0) { Messages.OutgoingMessages.Game.GMinion_FrankenScientist_stackChanged.sendMessage(this.position.board.player.game.players, this, REQUIRED_DEAD_MINION_COUNT - requiredDeadCount); } if (requiredDeadCount == 0) // yeteri kadar olu topladik mi? { ScrapGolemMinion fish = createNewGolem(game, ownerPlayer); position.board.AddMinionSpecificPosition(fish, position.pathPosition, false); fish.moveCustomDistance((new Random().Next(101)) / 200f - 0.25f); Science_Wars_Server.Messages.OutgoingMessages.Game.GMinion_FrankenScientist_spawn.sendMessage(game.players, this, fish); remainingSpawnCount--; requiredDeadCount = REQUIRED_DEAD_MINION_COUNT; Messages.OutgoingMessages.Game.GMinion_FrankenScientist_stackChanged.sendMessage(this.position.board.player.game.players, this, 0); } } } } else if (minionState == MinionState.DEAD && isReadyToDestroy()) // minionState i tekrar kontrol ettim. ne olur ne olmaz yeni bir state eklersek patlamasin. { onDestroy(); } } }