Example #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (MainGame game = new MainGame())
     {                                                                                
         game.Run();
     }
 }                   
        public CommandManager(MainGame game)
        {
            keyboardController = new KeyboardController();
            gamepadController = new GamepadController();

            marioFireCommand = new MarioFireCommand(game);
            marioDeadCommand = new MarioDieCommand();
            marioUpCommand = new MarioUpCommand(game);
            marioDownCommand = new MarioDownCommand(game);
            marioLeftCommand = new MarioLeftCommand(game);
            marioRightCommand = new MarioRightCommand(game);
            marioFireballCommand = new MarioFireballCommand(game);
            pauseCommand = new PauseCommand(game);
            resetCommand = new ResetCommand(game);
            quitCommand = new QuitCommand(game);

            keyboardController.RegisterCommand(Keys.P, pauseCommand);
            keyboardController.RegisterCommand(Keys.Q, quitCommand);
            keyboardController.RegisterCommand(Keys.R, resetCommand);
            gamepadController.RegisterCommand(Buttons.Back, quitCommand);
            keyboardController.RegisterCommand(Keys.F, marioFireCommand);
            keyboardController.RegisterCommand(Keys.O, marioDeadCommand);
            keyboardController.RegisterCommand(Keys.Up, marioUpCommand);
            keyboardController.RegisterCommand(Keys.Down, marioDownCommand);
            keyboardController.RegisterCommand(Keys.Left, marioLeftCommand);
            keyboardController.RegisterCommand(Keys.Right, marioRightCommand);
            keyboardController.RegisterCommand(Keys.X, marioFireballCommand);
        }
 public MarioFireballCommand(MainGame game) : base(game) { }
 public MarioLeftCommand(MainGame game) : base(game) { }