Example #1
0
 public override void HandleInput(GamePadState gamePadState, KeyboardState keyState, MouseState mouseState)
 {
     BattleMenu.HandleInput(gamePadState, keyState, mouseState, this);
     //if the battle is waiting for player input
     if (state == State.Input)
     {
         //get input based on key presses
         lock (battle.lockObject)
         {
             if (Input.InputHandler.WasKeyPressed(keyState, Keys.D1, 10) && battle.Positions[battle.waitingIndex].pokemon.move[0] != null)
             {
                 BattleChoice nextChoice = BattleChoice.UseMove(battle.Positions[battle.waitingIndex].pokemon.move[0], battle.Positions[1]);
                 battle.Positions[battle.waitingIndex].choice = nextChoice;
                 battle.waitingForPlayerInput = false;
                 Monitor.Pulse(battle.lockObject);
             }
             else if (Input.InputHandler.WasKeyPressed(keyState, Keys.D2, 10) && battle.Positions[battle.waitingIndex].pokemon.move[1] != null)
             {
                 BattleChoice nextChoice = BattleChoice.UseMove(battle.Positions[battle.waitingIndex].pokemon.move[1], battle.Positions[1]);
                 battle.Positions[battle.waitingIndex].choice = nextChoice;
                 battle.waitingForPlayerInput = false;
                 Monitor.Pulse(battle.lockObject);
             }
             else if (Input.InputHandler.WasKeyPressed(keyState, Keys.D3, 10) && battle.Positions[battle.waitingIndex].pokemon.move[2] != null)
             {
                 BattleChoice nextChoice = BattleChoice.UseMove(battle.Positions[battle.waitingIndex].pokemon.move[2], battle.Positions[1]);
                 battle.Positions[battle.waitingIndex].choice = nextChoice;
                 battle.waitingForPlayerInput = false;
                 Monitor.Pulse(battle.lockObject);
             }
             else if (Input.InputHandler.WasKeyPressed(keyState, Keys.D4, 10))
             {
                 BattleChoice nextChoice = BattleChoice.RunFromBattle();
                 battle.Positions[battle.waitingIndex].choice = nextChoice;
                 battle.waitingForPlayerInput = false;
                 Monitor.Pulse(battle.lockObject);
             }
         }
     }
 }