Пример #1
0
        /// <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);
            }
        }
Пример #2
0
 /// <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);
 }
Пример #3
0
 /// <summary>
 /// Start Listening to events
 /// </summary>
 private void StartAllListeners()
 {
     PC_EventManager.StartListening <int>(PC_EventSetup.Scene.LOAD_SCENE, LoadSceneWithIndex);
     PC_EventManager.StartListening <int, string>(PC_EventSetup.Scene.LOAD_SCENE_WITH_EVENT, LoadSceneAndEvent);
 }