Beispiel #1
0
 public void Initialize(Player.Player player)
 {
     this._player = player;
     player.PlayerDamaged += OnPlayerDamaged;
     player.CollidedWithTileBelow += Player_CollidedWithTileBelow;
 }
Beispiel #2
0
        protected override void Initialize()
        {
            Camera = new Camera(GraphicsDevice.Viewport);
            _menu = new Menu(this);
            _gameWorld = new GameWorld(this);
            Player = new Player.Player(this);
            _overlay = new Overlay();
            _cutscene = new Cutscene();
            Dialog = new Dialog();
            ObjectiveTracker = new ObjectiveTracker();
            MessageBox = new MessageBox();
            TextInputBox = new TextInputBox();

            DefaultTexture = ContentHelper.LoadTexture("Tiles/temp tile");
            GraphicsDeviceInstance = _graphics.GraphicsDevice;

            //Initialize the game render target
            _mainRenderTarget = new RenderTarget2D(GraphicsDevice, DefaultResWidth, DefaultResHeight, false,
                GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24,
                GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents);
            _lightingRenderTarget = new RenderTarget2D(GraphicsDevice, DefaultResWidth, DefaultResHeight, false,
                GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24,
                GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents);

            SpriteBatch = new SpriteBatch(GraphicsDevice);

            _lightBlendState = new BlendState
            {
                AlphaSourceBlend = Blend.DestinationColor,
                ColorSourceBlend = Blend.DestinationColor,
                ColorDestinationBlend = Blend.Zero
            };

            base.Initialize();
        }
Beispiel #3
0
 protected override void OnGameTick()
 {
     _player = (Player.Player)_player.Get();
 }
Beispiel #4
0
        public void Update(Main game1, Player.Player player, GameWorld map, bool isOnDebug)
        {
            if (!isOnDebug)
            {
                _textString = "";
                IsWritingCommand = false;
                map.IsOnDebug = false;
                return;
            }

            if (!IsWritingCommand)
            {
                map.IsOnDebug = false;
                if (Keyboard.GetState().IsKeyDown(Keys.LeftControl)
                    && Keyboard.GetState().IsKeyDown(Keys.LeftShift)
                    && Keyboard.GetState().IsKeyDown(Keys.C))
                {
                    IsWritingCommand = true;
                    _textString = "";
                    return;
                }
                else return;
            }
            else
            {
                map.IsOnDebug = true;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.LeftControl)
                    && Keyboard.GetState().IsKeyDown(Keys.LeftShift)
                    && Keyboard.GetState().IsKeyDown(Keys.C))
            {
                _textString = "";
            }

            if (_textString == "No command found" && Keyboard.GetState().IsKeyDown(Keys.Back))
                _textString = "";

            this._game1 = game1;
            this._player = player;

            _oldKeyboardState = _currentKeyboardState;
            _currentKeyboardState = Keyboard.GetState();

            InputHelper.TryLinkToKeyboardInput(ref _textString, _currentKeyboardState, _oldKeyboardState);
            if (InputHelper.IsKeyDown(Keys.Enter) &&!_definitionFound)
            {
                AnalyzeText();
            }
        }