private ACommand detonateMineProcess(DetonateMineCommand command, Battlefield.RobotAndBattlefield robotAndBattlefield) { BattlefieldRobot robot = robotAndBattlefield.ROBOT; Battlefield battlefield = robotAndBattlefield.BATTLEFIELD; MineLayer mineLayer = robot as MineLayer; if (mineLayer == null) { return(new ErrorCommand(robot.ROBOT_TYPE + " cannot use detonate mine command.")); } Mine mine; if (mineLayer.MINES_BY_ID.TryGetValue(command.MINE_ID, out mine) && mineLayer.HitPoints > 0) { mineLayer.MINES_BY_ID.Remove(command.MINE_ID); lock (battlefield.detonatedMines) { battlefield.detonatedMines.Add(mine); } return(new DetonateMineAnswerCommand(true)); } else { return(new DetonateMineAnswerCommand(false)); } }
public override bool IsTransferable(ACommand c) { DetonateMineCommand command = c as DetonateMineCommand; if (command != null) { cache.Cached(command, new DetonateMineCommandV1_0(command.MINE_ID)); return(true); } return(false); }