IEnumerator GameStart() { GameObject go = Instantiate(LoadingWnd); LoadingManager Loadingwnd = go.GetComponent <LoadingManager>(); AsyncOperation AO; AO = SceneManager.LoadSceneAsync("LobbyScene", LoadSceneMode.Additive); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(AO.progress); yield return(null); } Loadingwnd.SettingLoadingBar(1); yield return(new WaitForSeconds(2)); Destroy(Loadingwnd.gameObject); SoundManager._instance.PlayBGMSound(SoundManager.eBGMType.LOOBY); }
IEnumerator GameStart() { GameObject go = Instantiate(LoadingWnd); LoadingManager Loadingwnd = go.transform.GetChild(0).GetComponent <LoadingManager>(); AsyncOperation AO; AO = SceneManager.LoadSceneAsync("LobbyScene", LoadSceneMode.Additive); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(0.5f); yield return(new WaitForSeconds(2)); yield return(null); } Loadingwnd.SettingLoadingBar(1); yield return(new WaitForSeconds(2)); Destroy(Loadingwnd.transform.parent.gameObject); }
IEnumerator LoadingScene(string UnloadName, string LoadName) { GameObject go = Instantiate(LoadingWnd); LoadingManager Loadingwnd = go.GetComponent <LoadingManager>(); AsyncOperation AO; if (UnloadName != string.Empty) { AO = SceneManager.UnloadSceneAsync(UnloadName); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(0.33f); yield return(new WaitForSeconds(2)); yield return(null); } } Loadingwnd.SettingLoadingBar(0.33f); AO = SceneManager.LoadSceneAsync(LoadName, LoadSceneMode.Additive); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(0.66f); yield return(new WaitForSeconds(2)); yield return(null); } Loadingwnd.SettingLoadingBar(0.66f); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(1); yield return(new WaitForSeconds(2)); yield return(null); } Loadingwnd.SettingLoadingBar(1); //else //{ // AO = SceneManager.UnloadSceneAsync("InGameScene"); // while (!AO.isDone) // { // Loadingwnd.SettingLoadingBar(0.66f); // yield return null; // } // Loadingwnd.SettingLoadingBar(0.66f); // AO = SceneManager.LoadSceneAsync(LoadName, LoadSceneMode.Additive); // while (!AO.isDone) // { // Loadingwnd.SettingLoadingBar(1); // yield return null; // } // Loadingwnd.SettingLoadingBar(1); // yield return new WaitForSeconds(2); //} Destroy(Loadingwnd.gameObject); }
IEnumerator LoadingScene(string UnloadName, string LoadName) { GameObject go = Instantiate(LoadingWnd); LoadingManager Loadingwnd = go.transform.GetChild(0).GetComponent <LoadingManager>(); AsyncOperation AO; if (UnloadName != string.Empty) { AO = SceneManager.UnloadSceneAsync(UnloadName); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(0.33f); yield return(new WaitForSeconds(2)); yield return(null); } } Loadingwnd.SettingLoadingBar(0.33f); if (_currentScene == eSceneState.Play) { AO = SceneManager.LoadSceneAsync("InGameScene", LoadSceneMode.Additive); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(0.66f); yield return(new WaitForSeconds(2)); yield return(null); } Loadingwnd.SettingLoadingBar(0.66f); AO = SceneManager.LoadSceneAsync(LoadName, LoadSceneMode.Additive); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(1); yield return(new WaitForSeconds(2)); yield return(null); } Loadingwnd.SettingLoadingBar(1); InGameManager._instance.GameMapSetting(); } else { AO = SceneManager.UnloadSceneAsync("InGameScene"); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(0.66f); yield return(null); } Loadingwnd.SettingLoadingBar(0.66f); AO = SceneManager.LoadSceneAsync(LoadName, LoadSceneMode.Additive); while (!AO.isDone) { Loadingwnd.SettingLoadingBar(1); yield return(null); } Loadingwnd.SettingLoadingBar(1); yield return(new WaitForSeconds(2)); } Destroy(Loadingwnd.transform.parent.gameObject); }