Ejemplo n.º 1
0
 private void OnLoadStart(bool progressbarVisible)
 {
     m_isLoading     = true;
     m_progressValue = 0.0f;
     if (m_progressbar != null)
     {
         m_progressbar.SetProgress(m_progressValue);
         m_progressbar.SetText("loading 0%...");
         m_progressbar.gameObject.SetActive(progressbarVisible);
     }
     gameObject.SetActive(true);
 }
Ejemplo n.º 2
0
 IEnumerator LoadSceneAsync(string sceneName, LoadSceneMode mode)
 {
     m_asyncOperation                      = SceneManager.LoadSceneAsync(sceneName, mode);
     m_asyncOperation.completed           += OnAsyncComplete;
     m_asyncOperation.allowSceneActivation = false;
     while (!m_asyncOperation.isDone)
     {
         float progress = m_asyncOperation.progress;
         if (progress >= 0.9f)
         {
             m_asyncOperation.allowSceneActivation = true;
             m_progressbar.SetProgress(1.0f);
             m_progressbar.SetText("loading 100%...");
         }
         else
         {
             m_progressbar.SetProgress(progress);
             m_progressbar.SetText("loading " + Mathf.FloorToInt(progress * 100) + "%...");
         }
         yield return(null);
     }
 }