Example #1
0
        public override void Constant_Update(GameTime time, Entity entity)
        {
            base.Constant_Update(time, entity);
            var player = (Player)entity.Get(Types.Player);

            if (Input.It.Is_Key_Down(Keys.LeftControl) && Input.It.Is_Key_Pressed(Keys.P))
            {
                DesireAndDoom.Toggle_Pause();
            }

            // Toggle the gui and invatory screen
            var invatory = (Invatory)entity.Get(Types.Invatory);

            if (Input.It.Is_Key_Pressed(Keys.Q) || Input.It.Is_Gamepad_Button_Pressed(Buttons.Y))
            {
                show_overlay_gui = !show_overlay_gui;

                if (show_overlay_gui)
                {
                    player.State = Player.Action_State.IN_INVATORY;
                }
                else
                {
                    player.State = Player.Action_State.IDLE;
                }

                //DesireAndDoom.Toggle_Pause();
            }

            //if (Game1.Game_State == Game1.State.PAUSED && invatory.Draw)
            //    invatory_container.Update(time);
        }
Example #2
0
        public void Update(GameTime time)
        {
            if (Input.It.Is_Key_Pressed(Keys.Escape) || Input.It.Is_Gamepad_Button_Pressed(Buttons.Start))
            {
                Reset();
                DesireAndDoom.Toggle_Pause();
                showing = DesireAndDoom.Game_State == DesireAndDoom.State.PAUSED;
            }

            if (Input.It.Is_Gamepad_Button_Pressed(Buttons.B) && showing)
            {
                Reset();
                DesireAndDoom.Request_Resume();
                showing = DesireAndDoom.Game_State == DesireAndDoom.State.PAUSED;
            }

            if (!showing)
            {
                return;
            }

            var down = Input.It.Is_Key_Pressed(Keys.Down) || Input.It.Is_Gamepad_Button_Pressed(Buttons.DPadDown) || Input.It.Is_Gamepad_Button_Pressed(Buttons.LeftThumbstickDown);
            var up   = Input.It.Is_Key_Pressed(Keys.Up) || Input.It.Is_Gamepad_Button_Pressed(Buttons.DPadUp) || Input.It.Is_Gamepad_Button_Pressed(Buttons.LeftThumbstickUp);

            if (down)
            {
                selector++;
            }
            if (up)
            {
                selector--;
            }

            if (selector >= actions.Names.Length)
            {
                selector = 0;
            }
            if (selector < 0)
            {
                selector = actions.Names.Length - 1;
            }

            if (Input.It.Is_Key_Pressed(Keys.Enter) || Input.It.Is_Gamepad_Button_Pressed(Buttons.A))
            {
                actions.Call(selector);
            }
        }