Exemplo n.º 1
0
        public override void Update(GameTime gameTime, StateManager screen, GamePadState gamePadState, MouseState mouseState, KeyboardState keyboardState, InputHandler input)
        {
            if (GlobalValues.GoToMainMenu)
            {
                GlobalValues.GoToMainMenu = false;
            }

            if (input.WasPressed(0, InputHandler.ButtonType.B, Keys.Escape))
            {
                StateManager.game.Exit();
            }

            if (input.KeyboardState.WasKeyPressed(Keys.W) || input.WasPressed(0, InputHandler.ButtonType.X, Keys.Up))
            {
                if (currentSelectedItem != 0)
                {
                    currentSelectedItem--;
                }
            }

            if (input.KeyboardState.WasKeyPressed(Keys.S) || input.WasPressed(0, InputHandler.ButtonType.X, Keys.Down))
            {
                if (currentSelectedItem != 4)
                {
                    currentSelectedItem++;
                }
            }

            if (input.KeyboardState.WasKeyPressed(Keys.Space) || input.WasPressed(0, InputHandler.ButtonType.X, Keys.Enter))
            {
                switch (currentSelectedItem)
                {
                case 0:
                    MapSelectorScreen mapSelect = new MapSelectorScreen();
                    screen.Push(mapSelect);
                    break;

                case 1:
                    OptionsScreen options = new OptionsScreen();
                    screen.Push(options);
                    break;

                case 2:
                    MapCreatorScreen mapCreator = new MapCreatorScreen();
                    screen.Push(mapCreator);
                    break;

                case 3:
                    CreditsScreen credits = new CreditsScreen();
                    screen.Push(credits);
                    break;

                case 4:
                    StateManager.game.Exit();
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public override void Update(GameTime gameTime, StateManager screen, GamePadState gamePadState, MouseState mouseState, KeyboardState keyState, InputHandler input)
        {
            if (input.KeyboardState.WasKeyPressed(Keys.Escape) || input.WasPressed(0, InputHandler.ButtonType.B, Keys.B))
            {
                StateManager.game.Exit();
            }

            if (input.KeyboardState.WasKeyPressed(Keys.P) || input.WasPressed(0, InputHandler.ButtonType.A, Keys.A))
            {
                PlayScreen play = new PlayScreen();
                screen.Push(play);
            }

            if (input.KeyboardState.WasKeyPressed(Keys.C) || input.WasPressed(0, InputHandler.ButtonType.X, Keys.X))
            {
                CreditsScreen credits = new CreditsScreen();
                screen.Push(credits);
            }
        }