示例#1
0
        private ISpriteGamePadState HandleStateInput(ISpriteGamePadState currentState, GamePadCapabilities cap, GamePadState gamepadState)
        {
            var newState = currentState.HandleInput(this, cap, gamepadState);

            if (newState != null)
            {
                return(newState);
            }
            return(currentState);
        }
示例#2
0
        public override void Update(GameTime gameTime)
        {
            GamePadCapabilities cap = GamePad.GetCapabilities(PlayerIndex.One);

            if (cap.IsConnected)
            {
                GamePadState gamepadState = GamePad.GetState(PlayerIndex.One);

                _state     = HandleStateInput(_state, cap, gamepadState);
                _equipment = HandleStateInput(_equipment, cap, gamepadState);
            }

            _state.Update(this);
            _equipment.Update(this);
        }