Пример #1
0
        private void HandleInputReceived(InputResult inputResult)
        {
            var originalPosition = (Location)_player.Location.Clone();

            switch (inputResult)
            {
            case InputResult.North:
                _player.MovedNorth();
                break;

            case InputResult.South:
                _player.MovedSouth();
                break;

            case InputResult.West:
                _player.MovedWest();
                break;

            case InputResult.East:
                _player.MovedEast();
                break;

            default:
                break;
            }

            if (!_map.CanMoveTo(_player.Location.X, _player.Location.Y))
            {
                _player.Location.X = originalPosition.X;
                _player.Location.Y = originalPosition.Y;
            }

            if (_map.IsExit(_player.Location.X, _player.Location.Y))
            {
                RaiseFinished();
            }

            var renderables = _renderableFactory.CreateRenderable(_player);

            _renderer.Render(new [] { renderables });
        }
Пример #2
0
        public void Draw()
        {
            var renderables = _renderableFactory.CreateRenderable(_player);

            _renderer.Render(new [] { renderables });
        }