/// <summary> /// Coroutine called for loading the next scene /// </summary> /// <param name="_index"></param> /// <param name="_delayAfterLoading"></param> /// <param name="_eventName"></param> /// <returns></returns> IEnumerator LoadingScreen(int _index, float _delayAfterLoading = 1f, string _eventName = "") { m_loadingScreenGroup.SetActive(true); m_loadingText.text = PC_TextManager.GetText(PC_TextSetup.LoadingScreen.LOADING_TEXT); if (m_loadingAnimator) { m_loadingAnimator.SetBool("play", true); } AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(_index); // Wait until the asynchronous scene fully loads while (!asyncLoad.isDone) { yield return(null); } yield return(new WaitForSeconds(_delayAfterLoading)); if (m_loadingAnimator) { m_loadingAnimator.SetBool("play", false); } m_loadingScreenGroup.SetActive(false); if (!string.IsNullOrEmpty(_eventName)) { PC_EventManager.TriggerEvent(_eventName); } }
/// <summary> /// Initialize common data /// </summary> /// <param name="_dif"></param> public virtual void InitializeGame(DIFFICULTY _dif) { m_gameDifficulty = _dif; PC_AudioManager.PlayBGM(m_bgmClip); PC_EventManager.TriggerEvent(PC_EventSetup.LOAD_GAME); }