// Token: 0x060051B1 RID: 20913 RVA: 0x001BFFD0 File Offset: 0x001BE3D0
    public InputStateController PeekInputController()
    {
        InputStateController result = null;

        if (this.mInputStateControllerStack.Count > 0)
        {
            result = this.mInputStateControllerStack[this.mInputStateControllerStack.Count - 1];
        }
        return(result);
    }
    // Token: 0x060051AE RID: 20910 RVA: 0x001BFE78 File Offset: 0x001BE278
    public void PushInputController(string inputControllerName)
    {
        if (InputStateControllerManager.currentController != null)
        {
            InputStateControllerManager.currentController.enabled = false;
        }
        Type type = Type.GetType(inputControllerName);
        InputStateController inputStateController = (InputStateController)base.gameObject.AddComponent(type);

        this.mInputStateControllerStack.Add(inputStateController);
        inputStateController.OnActivate();
    }
    // Token: 0x060051B0 RID: 20912 RVA: 0x001BFF70 File Offset: 0x001BE370
    public InputStateController PopInputController()
    {
        InputStateController inputStateController = null;

        if (this.mInputStateControllerStack.Count > 1)
        {
            inputStateController = this.PeekInputController();
            this.mInputStateControllerStack.RemoveAt(this.mInputStateControllerStack.Count - 1);
            UnityEngine.Object.Destroy(inputStateController);
            this.PeekInputController().enabled = true;
            this.PeekInputController().OnActivate();
        }
        return(inputStateController);
    }
    // Token: 0x060051AF RID: 20911 RVA: 0x001BFECC File Offset: 0x001BE2CC
    public void SetBaseInputController(string inputControllerName)
    {
        bool enabled = true;

        if (this.mInputStateControllerStack.Count > 0 && this.mInputStateControllerStack[0] != null)
        {
            enabled = this.mInputStateControllerStack[0].enabled;
        }
        Type type = Type.GetType(inputControllerName);
        InputStateController inputStateController = (InputStateController)base.gameObject.AddComponent(type);

        if (this.mInputStateControllerStack.Count == 0)
        {
            this.mInputStateControllerStack.Add(null);
            inputStateController.OnActivate();
        }
        this.mInputStateControllerStack[0]         = inputStateController;
        this.mInputStateControllerStack[0].enabled = enabled;
    }
Exemplo n.º 5
0
        public override void HandleInput(InputStateController.InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            // Look up inputs for the active player profile.
            int playerIndex = (int)ControllingPlayer.Value;

            KeyboardState keyboardState = input.CurrentKeyboardState;
            GamePadState gamePadState = input.CurrentGamePadState;

            // The game pauses either if the user presses the pause button, or if
            // they unplug the active gamepad. This requires us to keep track of
            // whether a gamepad was ever plugged in, because we don't want to pause
            // on PC if they are playing with a keyboard and have no gamepad at all!
            bool gamePadDisconnected = !gamePadState.IsConnected &&
                                       input.GamePadWasConnected;

            if (input.IsPauseGame() || gamePadDisconnected)
            {
                sounds.PauseMusic();
                ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);
            }
            else
            {
                sounds.ResumeMusic();
                // handle input...move from Piece.cs
                if (input.IsKeyPressed(Keys.Right) && input.IsKeyPressed(Keys.Left))
                {
                    //do nothing
                }
                else if (input.IsKeyTriggered(Keys.Right) || input.IsLeftStickRightTriggered())
                {
                   currentPiece.moveRight();
                }
                else if (input.IsKeyTriggered(Keys.Left) || input.IsLeftStickLeftTriggered())
                {
                    currentPiece.moveLeft();
                }
                else if (input.IsKeyTriggered(Keys.Down) || input.IsLeftStickDownTriggered())
                {
                    currentPiece.moveDown(Direction.Soft);
                }
                else if (input.IsKeyTriggered(Keys.Up) || input.IsLeftStickUpTriggered())
                {
                    currentPiece.rotate();
                }
                else if (input.IsKeyTriggered(Keys.Space) || input.IsButtonTriggered(Buttons.A))
                {
                    currentPiece.drop();
                }
                else if (input.IsKeyTriggered(Keys.C) || input.IsButtonTriggered(Buttons.X))
                {
                    if (!currentPiece.Swapped)
                        currentPiece.swap();
                }

            }
        }
Exemplo n.º 6
0
 public JoyStrickState(InputStateController mController, Transform trans) : base(mController, trans)
 {
     this.MStateName = "JoyStrickState";
 }
Exemplo n.º 7
0
 public KeyBoardState(InputStateController mController, Transform trans) : base(mController, trans)
 {
     this.MStateName = "KeyBoardState";
 }
Exemplo n.º 8
0
 public IInputState(InputStateController mController, Transform trans)
 {
     m_Controller = mController;
     m_transform  = trans;
 }