private IEnumerator LoadSceneCoroutine(string sceneName, BeforeUnloadDelegate beforeUnloadDelegate) { TransitionCanvas.getInstance().FadeOut(0.5f); yield return(StartCoroutine(utils.Coroutine.WaitForRealSeconds(0.5f))); beforeUnloadDelegate(); PlayerScore.Reset(); SceneManager.LoadScene(sceneName); }
public static TransitionCanvas getInstance() { if (TransitionCanvas.instance == null) { GameObject FadeCanvasGO = (GameObject)MonoBehaviour.Instantiate(Resources.Load("UI/Fade Canvas")); TransitionCanvas.fadePanel = FadeCanvasGO.transform.GetChild(0).GetComponent <Image>(); TransitionCanvas.instance = FadeCanvasGO.GetComponent <TransitionCanvas>(); } return(TransitionCanvas.instance); }
/// <summary> /// Ensures that this object is a singleton. /// </summary> /// <returns></returns> private bool CheckForSingleton() { if (instance == null) { instance = this; DontDestroyOnLoad(this); return(false); } else { Destroy(this.gameObject); return(true); } }
public void PushPanel(TransitionCanvas newPanel) { if (panelStack.Count > 0 && panelStack.Peek() == newPanel) { PopCurrentMenu(); } else { // slight kludge, since we never make them inactive newPanel.gameObject.SetActive(true); if (panelStack.Count > 0) { panelStack.Peek().TransitionOut(); } newPanel.TransitionIn(); panelStack.Push(newPanel); } }
public bool IsTop(TransitionCanvas canvas) { return(panelStack.Count > 0 && panelStack.Peek() == canvas); }
void Awake() { TransitionCanvas.getInstance().FadeIn(0.5f); }
protected override void Awake() { base.Awake(); Instance = this; }