Exemplo n.º 1
0
    /// <summary>
    /// Update Function, process through Switch Button current Inputs.
    /// </summary>
    void Update()
    {
        // On Button Press
        if (Input.GetButtonDown(VRButton.toString(SwitchButton)))
        {
            setActivaton(true);
        }

        // If Button is Pressed
        if (Input.GetButton(VRButton.toString(SwitchButton)))
        {
            timeSincePress += Time.deltaTime;
            if (timeSincePress > TimeForChange)
            {
                timeSincePress -= TimeForChange;
                hasBeenChanged  = true;

                NextButton();
            }
        }

        // On Button Release
        if (Input.GetButtonUp(VRButton.toString(SwitchButton)))
        {
            if (!hasBeenChanged)
            {
                setActivaton(false);
            }

            timeSincePress = 0;
            hasBeenChanged = false;
        }
    }