Ejemplo n.º 1
0
        public void TestGetDownMarkItemReturnToGetDown()
        {
            RobotAi    ai     = new MockRobotAi();
            MockRobot  robot  = (MockRobot)ai.Robot;
            MockPlayer player = (MockPlayer)ai.Player;
            MockItem   item   = new MockItem(robot.Location);

            // Hold up
            robot.Head.Location = player.Disabler.Location = new MockLocation();
            ai.State            = RobotAiState.HeldUp;
            ai.Think();
            Assert.AreEqual(RobotAiState.HeldUp, ai.State);

            // Get down
            ai.GetDownRequested = true;
            ai.Think();
            Assert.AreEqual(RobotAiState.HeldUpGetDown, ai.State);
            Assert.AreEqual(RobotAnimation.CoweringOnGround, robot.PlayingAnimation);

            // Mark items
            ai.MarkItemsRequested = true;
            player.Items.Add(item);
            ai.Think();
            Assert.AreEqual(RobotAiState.HeldUpDemandMarkAmmo, ai.State);
            Assert.True(item.HasBeenMarkedForPlayer);

            // Return to get down
            ai.Think();
            Assert.AreEqual(RobotAiState.HeldUpGetDown, ai.State);
            Assert.AreEqual(RobotAnimation.CoweringOnGround, robot.PlayingAnimation);
        }
Ejemplo n.º 2
0
        public void TestHoldUpDontMarkFarAwayItem()
        {
            RobotAi    ai     = new MockRobotAi();
            MockRobot  robot  = (MockRobot)ai.Robot;
            MockPlayer player = (MockPlayer)ai.Player;
            MockItem   item   = new MockItem(new MockLocation(999, 999, 999));

            robot.Head.Location   = player.Disabler.Location = new MockLocation();
            ai.State              = RobotAiState.HeldUp;
            ai.MarkItemsRequested = true;

            // Item within reach
            player.Items.Add(item);
            ai.Think();

            Assert.AreEqual(RobotAiState.HeldUpDemandMarkAmmo, ai.State);
            Assert.False(item.HasBeenMarkedForPlayer);
        }