Exemple #1
0
        public void InteractionHandler_PlayerStandsOnStairs_LayerNumberIsIncremented()
        {
            // Arrange
            _gameState.Player.Position = new Position(8, 5);

            // Act
            _sut.Interact(_gameState);

            // Assert
            Assert.AreEqual(1, _gameState.Map.CurrentLayerNumber);
        }
        public void InteractionHandler_GameStateWithOneInteractive_InteractIsCalled()
        {
            IInteractiveObject interactiveMock = Substitute.For <IInteractiveObject>();

            _interactiveObjects[5, 5] = interactiveMock;

            _uut.Interact(_state);

            interactiveMock.Received().interact(Arg.Any <IGameState>());
        }
Exemple #3
0
        public IGameState ExecuteTurn(IGameState state)
        {
            IPlayer player = state.Player;

            ITile[,] tiles = state.Map.GetCurrentLayer().Tiles;
            ILayer layer = state.Map.GetCurrentLayer();

            if (_validator.Validate(player.Position, player.NextMove, tiles))
            {
                List <ICharacter>  characters     = _formatter.ToList(layer.Characters);
                Queue <ICharacter> characterTurns = _turnScheduler.Schedule(characters);
                _moveExecutioner.ExecuteMoves(characterTurns, layer);
                _interactionHandler.Interact(state);
            }

            return(state);
        }