void Update()
 {
     if (currentState != targetState)
     {
         StopCoroutine(currentState.ToString());
         previousState = currentState;
         currentState  = targetState;
         StartCoroutine(currentState.ToString());
     }
 }
Beispiel #2
0
 public void SwitchMenu(MenuStates toState)
 {
     //will always switch to loading menu if the Gamemanager is still loading
     //and then que the next menu transition while loading isn't complete
     if (GameManager.instance.isLoading && toState != MenuStates.Loading && !isMenuQued)
     {
         //if (GameManager.instance.debugMode)
         //    Debug.Log("Queing Menu of type: " + toState.ToString());
         isMenuQued = true;
         //override set the loading screen while other qued
         StartCoroutine(MenuQued(toState));
         toState = MenuStates.Loading;
     }
     //disables all the menus first, before turning on the specific one
     for (int i = 0; i < menus.Count; i++)
     {
         menus[i].enabled = false;
     }
     menus.Single(x => x.name == string.Format("Menu_{0}", toState.ToString())).enabled = true;
 }
Beispiel #3
0
 private void SwitchTo(MenuStates states)
 {
     //Debug.Log("Menu/" + states.ToString());
     transform.Find("Menu/" + states.ToString()).gameObject.SetActive(true);
 }