private IEnumerator LoadNextSceneCoroutine(float delay = 2.0f) { m_ChangerPanel.FaderText.text = "FLOOR " + (m_finshedLevelCount).ToString(); m_finshedLevelCount++; yield return(new WaitForSeconds(delay)); Player.SetAlive(false); //m_ChangerPanel.LoaderPanel.SetTrigger("Slide"); TweenAlpha.AddTween(m_ChangerPanel.Fader, 0, 1, 0.3f); yield return(new WaitForSeconds(0.75f)); m_uiroot.group.alpha = 1; AsyncOperation unload = SceneManager.UnloadSceneAsync(m_previousSceneName); m_currentSceneID = m_currentSceneID + 1; if (m_currentSceneID > 7) { m_currentSceneID = 3; } m_currentDifficulty = m_currentDifficulty + 1; m_previousSceneName = "Level_" + m_currentSceneID.ToString("00"); while (unload.isDone == false) { yield return(new WaitForEndOfFrame()); } //yield return new WaitForSeconds(1.0f); SceneManager.LoadScene(m_previousSceneName, LoadSceneMode.Additive); Player.animator.SetTrigger("Out"); yield return(new WaitForSeconds(1.0f)); //Destroy(Splash); //yield return new WaitForSeconds(0.3f); m_root = null; while (m_root == null) { m_root = GameObject.FindGameObjectWithTag("SceneRoot").GetComponent <SceneRoot>(); yield return(new WaitForEndOfFrame()); //yield return new WaitForSeconds(1.0f); } Player.transform.position = m_root.PlayerSpawn.position; //m_ChangerPanel.LoaderPanel.SetTrigger("SlideOut"); TweenAlpha.AddTween(m_ChangerPanel.Fader, 1, 0, 0.3f); //GameObject.FindGameObjectWithTag("SceneRoot").GetComponent<Animator>().SetTrigger("Slide"); yield return(new WaitForSeconds(00.3f)); Player.animator.SetTrigger("Fall"); yield return(new WaitForSeconds(00.5f)); Player.SetAlive(true); yield return(new WaitForSeconds(00.5f)); m_root.StartScene(m_currentDifficulty); LoadNextRoutine = null; }
private IEnumerator StartGameCoroutine() { AsyncOperation loadOp = SceneManager.LoadSceneAsync("Loader", LoadSceneMode.Additive); while (loadOp.isDone == false) { yield return(new WaitForEndOfFrame()); } GameObject uiRoot = GameObject.FindGameObjectWithTag("UI"); m_uiroot = uiRoot.GetComponent <UIRoot>(); m_uiroot.group.alpha = 0; m_ChangerPanel = GameObject.FindGameObjectWithTag("LoaderPanel").GetComponent <SceneChanger>(); m_ChangerPanel.GameOver.GetComponent <CanvasGroup>().alpha = 0; Player = GameObject.Instantiate(Resources.Load <PlayerMoveControler>("Player")); Player.transform.parent = Instance.transform; m_uiroot.InitialiseUI(Player); MoneyManager.instance.currentScore = 0; Player.SetAlive(false); //yield return new WaitForSeconds(10); LoadNextScene(0, "Title"); SoundManager.instance.PlayMusic(1); }