Esempio n. 1
0
 void UpdateGameInput()
 {
     if (inputHelper.CheckForKeyboardPress(Keys.Right) || inputHelper.CheckForGamepadPress(Buttons.DPadRight) || inputHelper.CheckForGamepadPress(Buttons.LeftThumbstickRight))
     {
         gameBoard.BeginMove(gameBoard.RIGHT);
     }
     else if (inputHelper.CheckForKeyboardPress(Keys.Left) || inputHelper.CheckForGamepadPress(Buttons.DPadLeft) || inputHelper.CheckForGamepadPress(Buttons.LeftThumbstickLeft))
     {
         gameBoard.BeginMove(gameBoard.LEFT);
     }
     else if (inputHelper.CheckForKeyboardPress(Keys.Up) || inputHelper.CheckForGamepadPress(Buttons.DPadUp) || inputHelper.CheckForGamepadPress(Buttons.LeftThumbstickUp))
     {
         gameBoard.BeginMove(gameBoard.UP);
     }
     else if (inputHelper.CheckForKeyboardPress(Keys.Down) || inputHelper.CheckForGamepadPress(Buttons.DPadDown) || inputHelper.CheckForGamepadPress(Buttons.LeftThumbstickDown))
     {
         gameBoard.BeginMove(gameBoard.DOWN);
     }
     else if (inputHelper.CheckForKeyboardPress(Keys.R) || inputHelper.CheckForGamepadPress(Buttons.Y) ||
              (inputHelper.CheckForGamepadHold(Buttons.LeftShoulder) && inputHelper.CheckForGamepadPress(Buttons.RightShoulder)))
     {
         DrawCallEvent -= GameOverDraw;
         DrawCallEvent -= GoalDraw2048;
         DrawCallEvent -= GoalDraw3072;
         NewGame();
     }
     else if (inputHelper.CheckForKeyboardPress(Keys.Space) || inputHelper.CheckForGamepadPress(Buttons.A))
     {
         DrawCallEvent -= GoalDraw2048;
         DrawCallEvent -= GoalDraw3072;
     }
     else if (inputHelper.CheckForKeyboardPress(Keys.Escape) || inputHelper.CheckForGamepadPress(Buttons.Back))
     {
         ReturnToTitleScreen();
     }
     else if (inputHelper.CheckForKeyboardPress(Keys.Enter) || inputHelper.CheckForGamepadPress(Buttons.Start))
     {
         ShowPauseMenu();
     }
 }