コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        // check the if the current index is this index
        if (menuButtonController.index == thisIndex)
        {
            animator.SetBool("selected", true);

            // check if the enter btn is pressed
            if (Input.GetAxisRaw("Submit") == 1)
            {
                animator.SetBool("pressed", true);

                // check if enter is pressed on any of the indeciesssa
                // index 1 - resume, index 2 - quit
                if (thisIndex == 1)
                {
                    pauseManager.ChangePauseValue();
                }
                else if (thisIndex == 2)
                {
                    StartCoroutine(SaveToMenuCoroutiine());
                }
                else if (thisIndex == 3)
                {
                    StartCoroutine(QuitToMenuCoroutiine());
                }
            }
            else if (animator.GetBool("pressed"))
            {
                animator.SetBool("pressed", false);
                menuButtonController.index = 0;
            }
        }
        else
        {
            animator.SetBool("selected", false);
        }
    }