Exemplo n.º 1
0
        public void Update()
        {
            KeyboardState currentState    = Keyboard.GetState();
            GamePadState  currentPadState = GamePad.GetState(PlayerIndex.One);

            if (!soundPlayed)
            {
                game.gameOverSound.Play();
                soundPlayed = true;
            }

            if (game.keyJustPressed(lastState, currentState, Keys.Escape) || game.padJustPressed(lastPadState, currentPadState, Buttons.Back))
            {
                game.Exit();
            }


            if (game.keyJustReleased(lastState, currentState, Keys.Enter) || game.padJustReleased(lastPadState, currentPadState, Buttons.A))
            {
                if (game.needName)
                {
                    game.setMode(game.ENTERNAME);
                }
                else
                {
                    game.setMode(game.LEADERBOARD);
                }
            }

            lastState    = currentState;
            lastPadState = currentPadState;
        }
Exemplo n.º 2
0
        public void Update()
        {
            GamePadState  newPadState = GamePad.GetState(PlayerIndex.One);
            KeyboardState newKeyState = Keyboard.GetState();

            if (game.keyJustPressed(lastKeyState, newKeyState, Keys.Up) || game.padJustPressed(lastPadState, newPadState, Buttons.DPadUp))
            {
                currentIndices[currentLetter]++;
                if (currentIndices[currentLetter] > (int)'Z')
                {
                    currentIndices[currentLetter] = (int)'A';
                }
            }

            if (game.keyJustPressed(lastKeyState, newKeyState, Keys.Down) || game.padJustPressed(lastPadState, newPadState, Buttons.DPadDown))
            {
                currentIndices[currentLetter]--;
                if (currentIndices[currentLetter] < (int)'A')
                {
                    currentIndices[currentLetter] = (int)'Z';
                }
            }

            if (game.keyJustPressed(lastKeyState, newKeyState, Keys.Right) || game.padJustPressed(lastPadState, newPadState, Buttons.DPadRight))
            {
                currentLetter++;
                if (currentLetter > (currentIndices.Length - 1))
                {
                    currentLetter = 0;
                }
            }

            if (game.keyJustPressed(lastKeyState, newKeyState, Keys.Left) || game.padJustPressed(lastPadState, newPadState, Buttons.DPadLeft))
            {
                currentLetter--;
                if (currentLetter < 0)
                {
                    currentLetter = (currentIndices.Length - 1);
                }
            }

            if (game.keyJustReleased(lastKeyState, newKeyState, Keys.Enter) || game.padJustReleased(lastPadState, newPadState, Buttons.A))
            {
                game.appendLeaderboard();
                game.setMode(game.LEADERBOARD);
            }

            lastPadState = newPadState;
            lastKeyState = newKeyState;

            updateOutput();
        }
Exemplo n.º 3
0
        public void Update()
        {
            KeyboardState currentState    = Keyboard.GetState();
            GamePadState  currentPadState = GamePad.GetState(PlayerIndex.One);

            if (game.keyJustPressed(lastState, currentState, Keys.Escape) || game.padJustPressed(lastPadState, currentPadState, Buttons.Back))
            {
                game.Exit();
            }


            if (game.keyJustReleased(lastState, currentState, Keys.Enter) || game.padJustReleased(lastPadState, currentPadState, Buttons.A))
            {
                game.Restart();
            }

            #region Replace bad names
            if (game.keyJustPressed(lastState, currentState, Keys.D0))
            {
                leaders[0] = new Leader("LIMS", leaders[0].getScore());
            }

            if (game.keyJustPressed(lastState, currentState, Keys.D1))
            {
                leaders[1] = new Leader("LIMS", leaders[1].getScore());
            }
            if (game.keyJustPressed(lastState, currentState, Keys.D2))
            {
                leaders[2] = new Leader("LIMS", leaders[2].getScore());
            }
            if (game.keyJustPressed(lastState, currentState, Keys.D3))
            {
                leaders[3] = new Leader("LIMS", leaders[3].getScore());
            }
            if (game.keyJustPressed(lastState, currentState, Keys.D4))
            {
                leaders[4] = new Leader("LIMS", leaders[4].getScore());
            }
            if (game.keyJustPressed(lastState, currentState, Keys.D5))
            {
                leaders[5] = new Leader("LIMS", leaders[5].getScore());
            }
            if (game.keyJustPressed(lastState, currentState, Keys.D6))
            {
                leaders[6] = new Leader("LIMS", leaders[6].getScore());
            }
            if (game.keyJustPressed(lastState, currentState, Keys.D7))
            {
                leaders[7] = new Leader("LIMS", leaders[7].getScore());
            }
            if (game.keyJustPressed(lastState, currentState, Keys.D8))
            {
                leaders[8] = new Leader("LIMS", leaders[8].getScore());
            }
            if (game.keyJustPressed(lastState, currentState, Keys.D9))
            {
                leaders[9] = new Leader("LIMS", leaders[9].getScore());
            }
            #endregion

            lastState    = currentState;
            lastPadState = currentPadState;
        }