Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (!canInput)
        {
            return;
        }

        menuInput.GatherInput();

        bool didPressConfirm = menuInput.DidPressConfirm();

        if (didPressConfirm)
        {
            OnButtonPressed();
        }

        int navDirection = menuInput.GetNavDirection();

        if (canMove && navDirection != 0)
        {
            // Subtract because navDirection up is positive but buttons are
            // indexed top-to-bottom.
            focusedButton = Mathf.Clamp(focusedButton - navDirection, 0, buttons.Count - 1);
            OnButtonFocusChanged();
            DebounceMoves();
        }
    }
Exemple #2
0
    void Update()
    {
        if (!isActive)
        {
            return;
        }
        menuInput.GatherInput();

        bool didPressConfirm = menuInput.DidPressConfirm();

        if (didPressConfirm)
        {
            SelectCurrentChoice();
        }
        else
        {
            int navDirection = menuInput.GetNavDirection();
            if (canMove && navDirection != 0)
            {
                focusedChoice = Mathf.Clamp(focusedChoice + navDirection, 0, choices.Count - 1);
                OnButtonFocusChanged();
                DebounceMoves();
            }
        }
    }