Пример #1
0
    protected void AnimatorControls()
    {
        if (menuButtonController.GetIndex() == thisIndex)
        {
            animator.SetBool("selected", true);
            if (Input.GetKeyDown(KeyCode.Return) && menuButtonController.IsAlive() || Input.GetKeyDown(KeyCode.Mouse0) && isOver)
            {
                animator.SetBool("pressed", true);
                OnPressedMenu();
            }
            else if (animator.GetBool("pressed"))
            {
                animator.SetBool("pressed", false);
            }
        }
        else
        {
            animator.SetBool("selected", false);
        }

        if (menuButtonController.GetMaxIndex() == thisIndex)
        {
            if (Input.GetKeyDown(KeyCode.Escape) && menuButtonController.IsAlive())
            {
                animator.SetBool("pressed", true);
                OnPressedMenu();
            }
            else if (animator.GetBool("pressed"))
            {
                animator.SetBool("pressed", false);
            }
        }
    }
Пример #2
0
 private void HideOptionsMenu()
 {
     if (optionMenu != null)
     {
         if (Input.GetKeyDown(KeyCode.Escape))
         {
             isOptions = menuButtonController.IsAlive();
             if (isOptions)
             {
                 isOptions = false;
                 menuButtonController.SetIndex(menuButtonController.GetMaxIndex());
             }
             else
             {
                 isOptions = true;
             }
             optionMenu.SetActive(isOptions);
             menuButtonController.SetIsAlive(isOptions);
         }
         if (isOptions && (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Mouse0)) &&
             menuButtonController.GetIndex() == menuButtonController.GetMaxIndex())
         {
             StartCoroutine(WaitAndSet());
         }
         if (isOptions)
         {
             Time.timeScale = 0f;
         }
         else
         {
             Time.timeScale = 1f;
         }
     }
 }
Пример #3
0
 private void Start()
 {
     LoadVolume();
     if (optionMenu != null)
     {
         menuButtonController = optionMenu.GetComponent <MenuButtonController>();
         isOptions            = menuButtonController.IsAlive();
     }
 }