示例#1
0
        public void LoadBasicCommand()
        {
            ICommand exitGameCommand  = new ExitGameCommand(this);
            ICommand resetGameCommand = new ResetGameCommand(this);

            keyboardController.BindKey(Keys.Q, exitGameCommand);
            keyboardController.BindKey(Keys.R, resetGameCommand);
        }
示例#2
0
        public void LoadGamePausedCommand()
        {
            ICommand resumeGameCommand = new ResumeGameCommand(this);
            ICommand exitGameCommand   = new ExitGameCommand(this);

            keyboardController.BindKey(Keys.Q, exitGameCommand);
            keyboardController.BindKey(Keys.O, resumeGameCommand);
        }
示例#3
0
        public void LoadGamePlayingCommand()
        {
            ICommand exitGameCommand  = new ExitGameCommand(this);
            ICommand resetGameCommand = new ResetGameCommand(this);
            ICommand setMarioToIdleOrJumpingStateCommand   = new SetMarioToIdleOrJumpingStateCommand();
            ICommand setMarioToIdleOrCrouchingStateCommand = new SetMarioToIdleOrCrouchingStateCommand(mario);
            ICommand setMarioDirectionToLeftCommand        = new SetMarioDirectionToLeftCommand(mario);
            ICommand setMarioDirectionToRightCommand       = new SetMarioDirectionToRightCommand(mario);
            ICommand setLuigiToIdleOrJumpingStateCommand   = new SetLuigiToIdleOrJumpingStateCommand(luigi);
            ICommand setLuigiToIdleOrCrouchingStateCommand = new SetLuigiToIdleOrCrouchingStateCommand(luigi);
            ICommand setLuigiDirectionToLeftCommand        = new SetLuigiDirectionToLeftCommand(luigi);
            ICommand setLuigiDirectionToRightCommand       = new SetLuigiDirectionToRightCommand(luigi);
            ICommand setLuigiRunCommand        = new SetLuigiRunCommand(luigi);
            ICommand setMarioRunCommand        = new SetMarioRunCommand(mario);
            ICommand shootFireBallCommand      = new ShootFireBallCommand(mario);
            ICommand luigiShootFireBallCommand = new LuigiShootFireBallCommand(luigi);
            ICommand pauseGameCommand          = new PauseGameCommand(this);

            keyboardController.BindKey(Keys.Q, exitGameCommand);
            keyboardController.BindKey(Keys.R, resetGameCommand);
            if (isPkMode)
            {
                keyboardController.BindKey(Keys.S, setLuigiToIdleOrCrouchingStateCommand);
                keyboardController.BindKey(Keys.W, setLuigiToIdleOrJumpingStateCommand);
                keyboardController.BindKey(Keys.D, setLuigiDirectionToRightCommand);
                keyboardController.BindKey(Keys.C, luigiShootFireBallCommand);
                keyboardController.BindKey(Keys.A, setLuigiDirectionToLeftCommand);
                keyboardController.BindKey(Keys.X, setLuigiRunCommand);
            }

            keyboardController.BindKey(Keys.Up, setMarioToIdleOrJumpingStateCommand);
            keyboardController.BindKey(Keys.Down, setMarioToIdleOrCrouchingStateCommand);
            keyboardController.BindKey(Keys.Left, setMarioDirectionToLeftCommand);
            keyboardController.BindKey(Keys.Right, setMarioDirectionToRightCommand);
            keyboardController.BindKey(Keys.M, setMarioRunCommand);
            keyboardController.BindKey(Keys.L, shootFireBallCommand);
            keyboardController.BindKey(Keys.P, pauseGameCommand);
        }