Beispiel #1
0
 public void Execute_IsInvoked()
 {
     //rm.Setup(x => rm.Object.ActionMoveDown());
     rc = new MoveDownCommand(rm.Object);
     rc.Execute();
     Assert.AreEqual(1, 1);
     //Mock.Get(rm).Verify(x => rm.Object.ActionMoveDown(), Times.Exactly(1));
 }
        protected override GamePhase Run(GameLogic game)
        {
            int commandId = game.Programming.GetRegister(game.executionState.CurrentRobot)[game.executionState.CurrentRegister];

            if (commandId != -1 && (game.Entitys[game.executionState.CurrentRobot] as RobotInfo)?.Health > 0)            //-1 is an empty register
            {
                RobotCommand cmd = game.Programming[commandId];
                cmd.Execute(game, game.executionState.CurrentRobot);
                Thread.Sleep(game.AnimationDelay);
            }
            return(new PostStatementPhase());
        }
Beispiel #3
0
        public override void Do(GameLogic game, int robotId)
        {
            int currentRegister = game.executionState.CurrentRegister;

            int[] register = game.Programming.GetRegister(robotId);
            for (int i = 1; i <= currentRegister; i++)
            {
                int          cardId  = register[currentRegister - 1 * i];
                RobotCommand command = game.Programming[cardId];
                if (command.Type.Equals(Instruction.Repeat))
                {
                    continue;
                }
                command.Execute(game, robotId);
                return;
            }
            game.Movement.Move(robotId, 1, RelativeDirection.Forward);
        }