Ejemplo n.º 1
0
        public void GivenPlayer_WhenUsesFireTorpedoes_ThenTorpedoGameObjectGenerated()
        {
            SetupFakeWorld(true);
            var bot = WorldStateService.GetPlayerBots().First();

            bot.PendingActions.Add(
                new PlayerAction
            {
                Action   = PlayerActions.FireTorpedoes,
                Heading  = 180,
                PlayerId = bot.Id
            });
            actionService.ApplyActionToBot(bot);

            Assert.IsNotEmpty(WorldStateService.GetMovableObjects()
                              .Where(obj => obj.GameObjectType == GameObjectType.TorpedoSalvo));
        }
Ejemplo n.º 2
0
        public void GivenDeadBot_WithAfterburnerStarted_ThenRemoveFromWorldWhenSizeLessThan5()
        {
            SetupFakeWorld();
            var bot         = FakeGameObjectProvider.GetBotAtDefault();
            var firstAction = FakeGameObjectProvider.GetStartAfterburnerPlayerAction(bot.Id);

            bot.PendingActions = new List <PlayerAction>
            {
                firstAction
            };

            for (var j = 0; j < 6; j++)
            {
                Assert.DoesNotThrow(() => actionService.ApplyActionToBot(bot));
                Assert.DoesNotThrow(() => WorldStateService.ApplyAfterTickStateChanges());
            }

            Assert.AreEqual(4, bot.Size);
            Assert.False(WorldStateService.GameObjectIsInWorldState(bot.Id));
        }
Ejemplo n.º 3
0
        public void GivenBot_WhenBotHasNoPendingActions_ThenProcessNothing()
        {
            var bot = FakeGameObjectProvider.GetBotAtDefault();

            bot.PendingActions = null;

            Assert.DoesNotThrow(() => actionService.ApplyActionToBot(bot));
        }