コード例 #1
0
ファイル: InputManager.cs プロジェクト: Schuket/CloudNine
        public float GetAxis(GamePadID controllerID, GamePadAxis axis)
        {
            int id = (int)controllerID;

            if (!m_gamePads[id].playerIndexSet)
            {
                return(0f);
            }

            switch (axis)
            {
            case GamePadAxis.LeftJoystickX:
                return(m_gamePads[id].state.ThumbSticks.Left.X);

            case GamePadAxis.LeftJoystickY:
                return(m_gamePads[id].state.ThumbSticks.Left.Y);

            case GamePadAxis.RightJoystickX:
                return(m_gamePads[id].state.ThumbSticks.Right.X);

            case GamePadAxis.RightJoystickY:
                return(m_gamePads[id].state.ThumbSticks.Right.Y);

            case GamePadAxis.LeftTrigger:
                return(m_gamePads[id].state.Triggers.Left);

            case GamePadAxis.RightTrigger:
                return(m_gamePads[id].state.Triggers.Left);

            default:
                return(0f);
            }
        }
コード例 #2
0
ファイル: InputManager.cs プロジェクト: Schuket/CloudNine
        public InputEvent GetEvent(GamePadID controllerID, GamePadInput input)
        {
            int id = (int)controllerID;

            switch (input)
            {
            case GamePadInput.ButtonA:
                return(m_gamePads[id].padEvent.OnButtonA);

            case GamePadInput.ButtonB:
                return(m_gamePads[id].padEvent.OnButtonB);

            case GamePadInput.ButtonX:
                return(m_gamePads[id].padEvent.OnButtonX);

            case GamePadInput.ButtonY:
                return(m_gamePads[id].padEvent.OnButtonY);

            case GamePadInput.ButtonARelease:
                return(m_gamePads[id].padEvent.OnButtonARelease);

            case GamePadInput.RightBumper:
                return(m_gamePads[id].padEvent.OnButtonRightBumper);

            case GamePadInput.LeftBumper:
                return(m_gamePads[id].padEvent.OnButtonLeftBumper);

            case GamePadInput.ButtonStart:
                return(m_gamePads[id].padEvent.OnButtonStart);

            case GamePadInput.DPadDown:
                return(m_gamePads[id].padEvent.OnDPadDown);

            case GamePadInput.DPadLeft:
                return(m_gamePads[id].padEvent.OnDPadLeft);

            case GamePadInput.DPadUp:
                return(m_gamePads[id].padEvent.OnDPadUp);

            case GamePadInput.DPadRight:
                return(m_gamePads[id].padEvent.OnDPadRight);

            default:
                return(null);
            }
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: Schuket/CloudNine
        public void AssignGamePad(GamePadID newGamePad)
        {
            if (m_currGamePadID == newGamePad)
            {
                return;
            }

            if (m_currGamePadID != GamePadID.None)
            {
                DisableInputEvent();
            }

            m_currGamePadID = newGamePad;

            if (isActiveAndEnabled)
            {
                EnableInputEvent();
            }
        }
コード例 #4
0
ファイル: InputManager.cs プロジェクト: Schuket/CloudNine
        public void CleanGamePadEvent(GamePadID controllerID)
        {
            int id = (int)controllerID;

            m_gamePads[id].padEvent.OnButtonA.RemoveAllListeners();
            m_gamePads[id].padEvent.OnButtonB.RemoveAllListeners();
            m_gamePads[id].padEvent.OnButtonX.RemoveAllListeners();
            m_gamePads[id].padEvent.OnButtonY.RemoveAllListeners();

            m_gamePads[id].padEvent.OnButtonARelease.RemoveAllListeners();

            m_gamePads[id].padEvent.OnButtonRightBumper.RemoveAllListeners();
            m_gamePads[id].padEvent.OnButtonLeftBumper.RemoveAllListeners();

            m_gamePads[id].padEvent.OnButtonStart.RemoveAllListeners();

            m_gamePads[id].padEvent.OnDPadDown.RemoveAllListeners();
            m_gamePads[id].padEvent.OnDPadLeft.RemoveAllListeners();
            m_gamePads[id].padEvent.OnDPadRight.RemoveAllListeners();
            m_gamePads[id].padEvent.OnDPadUp.RemoveAllListeners();
        }
コード例 #5
0
ファイル: InputManager.cs プロジェクト: Schuket/CloudNine
 public void ShakeGamePad(GamePadID id, float left, float right)
 {
     GamePad.SetVibration((PlayerIndex)id, left, right);
 }