/// <summary>
    /// Method that updates the visual state of the button to be pressed down.
    /// </summary>
    private void OnPressedDown()
    {
        _buttonPressed = true;

        // Animate the visual feedback. This method will also first stop an animation if it is already running.
        _uiGazeToggleButtonGraphics.StartVisualFeedbackAnimation(_hasFocus, IsToggledOn, _buttonPressed);
    }
예제 #2
0
    private void Update()
    {
        // If the interaction button is pressed when the toggle has focus, press the button down.
        if (ControllerManager.Instance.GetButtonPressDown(TriggerButton) && _hasFocus)
        {
            OnPressedDown();
        }
        // If the interaction button is released.
        if (ControllerManager.Instance.GetButtonPressUp(TriggerButton))
        {
            // If the interaction button is released from being pressed down, toggle the button.
            if (_buttonPressed)
            {
                Toggle();
            }

            // Animate the toggle button.
            _uiGazeToggleButtonGraphics.StartVisualFeedbackAnimation(_hasFocus, _isToggledOn, _buttonPressed);
        }
    }