示例#1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            controllerList = new List <IController>();

            KeyboardController keyboard = new KeyboardController(this);
            GamePadController  gamepad  = new GamePadController(this);

            keyboard.RegisterCommand(Keys.Q, new QuitCommand(this));
            keyboard.RegisterCommand(Keys.W, new StaticCommand(this));
            keyboard.RegisterCommand(Keys.E, new AnimatedNotMovingCommand(this));
            keyboard.RegisterCommand(Keys.R, new MovingNotAnimatedCommand(this));
            keyboard.RegisterCommand(Keys.T, new AnimatedAndMovingCommand(this));

            gamepad.RegisterCommand(Buttons.Start, new QuitCommand(this));
            gamepad.RegisterCommand(Buttons.A, new StaticCommand(this));
            gamepad.RegisterCommand(Buttons.B, new AnimatedAndMovingCommand(this));
            gamepad.RegisterCommand(Buttons.X, new MovingNotAnimatedCommand(this));
            gamepad.RegisterCommand(Buttons.Y, new AnimatedAndMovingCommand(this));


            this.controllerList.Add(keyboard);
            this.controllerList.Add(gamepad);

            startPosition = new Vector2(InitialPosX, InitialPosY);

            base.Initialize();
        }
示例#2
0
        protected void RegisterCommands()
        {
            keyboard.RegisterCommand(Keys.Q, new EndGameCommand(this));
            keyboard.RegisterCommand(Keys.W, new StandingInPlaceTidusCommand(this));
            keyboard.RegisterCommand(Keys.E, new FixedAnimatedTidusCommand(this));
            keyboard.RegisterCommand(Keys.R, new KillTidusCommand(this));
            keyboard.RegisterCommand(Keys.T, new MovingAnimatedTidusCommand(this));

            gamepad.RegisterCommand(Buttons.Start, new EndGameCommand(this));
            gamepad.RegisterCommand(Buttons.A, new StandingInPlaceTidusCommand(this));
            gamepad.RegisterCommand(Buttons.B, new FixedAnimatedTidusCommand(this));
            gamepad.RegisterCommand(Buttons.X, new KillTidusCommand(this));
            gamepad.RegisterCommand(Buttons.Y, new MovingAnimatedTidusCommand(this));
        }