Exemple #1
0
    /// <summary>
    /// Update interactor location and act on events
    /// </summary>
    public void Update()
    {
        foreach (Transform menuItem in _menuItems)
        {
            var interactorId = menuItem.name;

            // Update location
            var interactor = _eyeXHost.GetInteractor(interactorId);
            interactor.Location = CreateLocation(menuItem, _gameMenu.IsVisible);

            // Check if activated
            if (interactor.IsActivated())
            {
                HandleActivation(interactorId);
            }

            // Check if focus has changed
            var activationFocusState = interactor.GetActivationFocusState();
            if (activationFocusState == ActivationFocusState.HasActivationFocus ||
                activationFocusState == ActivationFocusState.HasTentativeActivationFocus)
            {
                HighlightMenuItem(menuItem);
            }
            else
            {
                RestoreMenuItem(menuItem);
            }

            // Manually bind the Right Shift key to trigger an activation mode on, on key down
            if (Input.GetKeyDown(KeyCode.RightShift))
            {
                _eyeXHost.TriggerActivationModeOn();
            }

            // Manually bind the Right Shift key to trigger an activation, on key up
            if (Input.GetKeyUp(KeyCode.RightShift))
            {
                _eyeXHost.TriggerActivation();
            }
        }
    }