public void AddGamePadControllerCommands(IGamePadController gamePad1_, IGamePadController gamePad2_) { this.gamePad1 = gamePad1_; this.gamePad2 = gamePad2_; AddGamePadCommands(marios[GameUtilities.Player1], this.gamePad1); AddGamePadCommands(marios[GameUtilities.Player2], this.gamePad2); }
private void InitializeControllers() { keyboardPlayer1 = new KeyboardController(); keyboardPlayer2 = new KeyboardController(); gamePad1 = new GamePadController(); gamePad2 = new GamePadController(); allObjectsManager.AddKeyboardControllerCommands(keyboardPlayer1, keyboardPlayer2); allObjectsManager.AddGamePadControllerCommands(gamePad1, gamePad2); }
private static void AddGamePadCommands(IMario mario, IGamePadController keyboard) { if (mario == null) { return; } keyboard.RegisterMario(mario); keyboard.ClearAllCommandDicts(); keyboard.RegisterCommand(KeyboardKeys2.Start, Buttons.Start, new EnterCommand((Game1)GameUtilities.Game)); keyboard.RegisterCommand(KeyboardKeys2.Left, Buttons.DPadLeft, new LeftMarioCommand(mario)); keyboard.RegisterCommand(KeyboardKeys2.A, Buttons.A, new MarioUpCommand(mario)); keyboard.RegisterCommand(KeyboardKeys2.B, Buttons.B, new MarioAcceCommand(mario, mario.Player)); keyboard.RegisterCommand(KeyboardKeys2.Right, Buttons.DPadRight, new RightMarioCommand(mario)); keyboard.RegisterCommand(KeyboardKeys2.Down, Buttons.DPadDown, new MarioDownCommand(mario)); keyboard.RegisterReleasedCommand(KeyboardKeys2.Left, Buttons.DPadLeft, new ReleasedLeftMarioCommand(mario)); keyboard.RegisterReleasedCommand(KeyboardKeys2.Right, Buttons.DPadRight, new ReleasedRightMarioCommand(mario)); keyboard.RegisterReleasedCommand(KeyboardKeys2.Down, Buttons.DPadDown, new ReleasedDownMarioCommand(mario)); keyboard.RegisterReleasedCommand(KeyboardKeys2.B, Buttons.A, new ReleasedAcceMarioCommand(mario)); keyboard.RegisterReleasedCommand(KeyboardKeys2.A, Buttons.B, new ReleasedUpMarioCommand(mario)); }