示例#1
0
        // --------------------
        // TEST ENABLE/DISABLE
        // --------------------

        private void TestEnableDisable()
        {
            if (toggleGamepadOnGPressed && Input.GetKeyDown(KeyCode.G))
            {
                if (currentButton == null)
                {
                    Debug.Log("Current gamepad has not been set");
                    return;
                }
                if (currentButton.gamepad.isEnabled)
                {
                    currentButton.gamepad.Disable();
                    Debug.Log("Disabling " + currentButton.gamepad.name);
                }
                else
                {
                    currentButton.gamepad.Enable();
                    Debug.Log("Enabling " + currentButton.gamepad.name);
                }
            }

            if (toggleStickOnPPressed && Input.GetKeyDown(KeyCode.P))
            {
                if (currentStick == null)
                {
                    Debug.Log("Current stick has not been set");
                    return;
                }
                if (currentStick.isEnabled)
                {
                    currentStick.Disable();
                    Debug.Log("Disabling " + currentStick.name);
                }
                else
                {
                    currentStick.Enable();
                    Debug.Log("Enabling " + currentStick.name);
                }
            }

            if (toggleButtonOnBPressed && Input.GetKeyDown(KeyCode.B))
            {
                if (currentButton == null)
                {
                    Debug.Log("Current button has not been set");
                    return;
                }
                if (currentButton.isEnabled)
                {
                    currentButton.Disable();
                    Debug.Log("Disabling " + currentButton.name);
                }
                else
                {
                    currentButton.Enable();
                    Debug.Log("Enabling " + currentButton.name);
                }
            }
        }