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 Pause_Menu(Screen_Manager screen_manager, GameCamera _camera)
        {
            camera = _camera;

            rect = Assets.It.Get <Texture2D>("gui-rect");
            font = Assets.It.Get <SpriteFont>("gfont");

            actions = new Named_Action_List(new Dictionary <string, Action> {
                { "Resume", () => {
                      DesireAndDoom.Request_Resume();
                      showing = false;
                  } },
                { "Settings", () => {
                  } },
                { "Level Select", () =>
                  {
                      showing = false;
                      screen_manager.Goto_Screen("Level Select", false);
                  } },
                { "Exit", () => {
                      //DesireAndDoom.Request_Resume();
                      showing = false;
                      screen_manager.Goto_Screen("Menu", true);
                  } }
            });
        }
Example #3
0
        public override void Load(params string [] args)
        {
            world.Destroy_All();
            lighting.AmbientColor = new Color(0.6f, 0.6f, 0.6f, 1.0f);
            if (args.Length > 0)
            {
                Load_Map(args[0]);
            }
            else
            {
                Load_Map("Dungeon_Room_2");
            }
            //Load_Map("Ship");
            //Load_Map("Demo");
            //Load_Map("Dungeon_Floor_1");

            var ai_system = (AI_System)world.Get_System <AI_System>();

            ai_system.Give_Map(Map);

            //var song = Song.FromUri("Bloom", new Uri("Content/Audio/Bloom.mp3", UriKind.Relative));
            //MediaPlayer.Play(song);
            MediaPlayer.IsRepeating = true;

            camera.Zoom = DesireAndDoom.SCALE;
            DesireAndDoom.Request_Resume(); // Make sure the game is unpaused
        }
        public override void Update(GameTime gameTime)
        {
            if (Input.It.Is_Key_Pressed(Keys.Left))
            {
                cursor.X--;
            }
            if (Input.It.Is_Key_Pressed(Keys.Right))
            {
                cursor.X++;
            }

            if (cursor.X > text.Length)
            {
                cursor.X = text.Length;
            }
            if (cursor.X < 0)
            {
                cursor.X = 0;
            }

            if (Input.It.Is_Key_Pressed(Keys.Up))
            {
                if (history.Count > 0)
                {
                    text     = history.Last();
                    cursor.X = text.Length;
                    history.Remove(history.Last());
                }
            }

            if (Input.It.Is_Key_Pressed(Keys.OemTilde) && !Input.It.Is_Key_Down(Keys.LeftShift))
            {
                if (state == State.CLOSED)
                {
                    state = State.QUARTER;
                }
                else if (state == State.QUARTER)
                {
                    state = State.HALF;
                }
                else if (state == State.HALF)
                {
                    state = State.CLOSED;
                }

                if (state != State.CLOSED)
                {
                    Open = true;
                    DesireAndDoom.Request_Pause();
                }
                else
                {
                    //DesireAndDoom.Request_Resume();
                    Open = false;
                    DesireAndDoom.Request_Resume();
                }
            }
        }
Example #5
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);
            }
        }