示例#1
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;
        }