コード例 #1
0
    public void Update()
    {
        if (monitorButtonsActive && !PhotoController.photosActive && !PhotoController.photosLoading)
        {
            if (readyForInput == false)
            {
                if (GamepadInput.GetUp(GamepadInput.InputOption.A_BUTTON))
                {
                    readyForInput = true;
                }
            }

            if (GamepadInput.GetDown(GamepadInput.InputOption.A_BUTTON) && readyForInput)
            {
                monitorButtons[selectedButtonIndex].ToggleButton();
            }

            if (GamepadInput.GetDown(GamepadInput.InputOption.LEFT_STICK_HORIZONTAL))
            {
                float value = GamepadInput.GetInputValue(GamepadInput.InputOption.LEFT_STICK_HORIZONTAL);

                if (value < 0)
                {
                    SelectNextButton(-1);
                }
                else if (value > 0)
                {
                    SelectNextButton(1);
                }
            }

            else if (GamepadInput.GetDown(GamepadInput.InputOption.RIGHT_STICK_HORIZONTAL))
            {
                float value = GamepadInput.GetInputValue(GamepadInput.InputOption.RIGHT_STICK_HORIZONTAL);

                if (value < 0)
                {
                    SelectNextButton(-1);
                }
                else if (value > 0)
                {
                    SelectNextButton(1);
                }
            }
        }
    }
コード例 #2
0
    public void CheckForInput()
    {
        if (GamepadInput.GetDown(InputOption.A_BUTTON))
        {
            Debug.Log("A button was pressed down!");
        }

        if (GamepadInput.Get(InputOption.A_BUTTON))
        {
            Debug.Log("A button is being held down!");
        }

        if (GamepadInput.GetUp(InputOption.A_BUTTON))
        {
            Debug.Log("A button was released!");
        }

        if (GamepadInput.Get(InputOption.LEFT_STICK_HORIZONTAL))
        {
            float stickValue = GamepadInput.GetInputValue(InputOption.LEFT_STICK_HORIZONTAL);

            if (stickValue > 0)
            {
                Debug.Log("Left analog stick pushed to the right!");
            }
            else if (stickValue < 0)
            {
                Debug.Log("Left analog stick pushed to the left!");
            }
        }

        if (GamepadInput.Get(InputOption.RIGHT_STICK_VERTICAL))
        {
            float stickValue = GamepadInput.GetInputValue(InputOption.RIGHT_STICK_VERTICAL);

            if (stickValue > 0)
            {
                Debug.Log("Right stick pushed up!");
            }
            else if (stickValue < 0)
            {
                Debug.Log("Right stick pushed down!");
            }
        }
    }