IEnumerator LoadGameLevel(string levelName) { yield return(StartCoroutine(FadeScript.instance.FadeOut())); FadeScript.instance.gameObject.SetActive(false); _levelLoadingUI.SetActive(true); StaticMapInfo.SetLevelLoadData(levelName, true); AsyncOperation asyncMaster = SceneManager.LoadSceneAsync("Master"); AsyncOperation asyncLevel = SceneManager.LoadSceneAsync(levelName, LoadSceneMode.Additive); asyncMaster.allowSceneActivation = false; asyncLevel.allowSceneActivation = false; //_isLoading = true; while (asyncMaster.progress < 0.9f && asyncLevel.progress < 0.9f) { yield return(null); } yield return(new WaitForSeconds(1f)); yield return(StartCoroutine(FadeScript.instance.FadeOut())); asyncMaster.allowSceneActivation = true; asyncLevel.allowSceneActivation = true; while (!SceneManager.GetSceneByName(levelName).isLoaded) { yield return(null); } SceneManager.UnloadSceneAsync(SceneManager.GetActiveScene().name); }
/// <summary> /// Go to level editor scene /// </summary> public void LevelEditor() { // _soundManager.ButtonClick(); StaticMapInfo.LoadingIntoLevelEditor = true; StaticMapInfo.SetLevelLoadData("", false); StaticMapInfo.LevelEditorMode = WorldController.CurrentGameMode.Editor; StartCoroutine(FadeLoad("Master")); }
public void LoadMap(string mapName, bool IsResource) { _yourMapsPanel.SetActive(false); StaticMapInfo.LevelEditorLevel = mapName; StaticMapInfo.LoadIntoEditor(false); StaticMapInfo.SetLevelLoadData(mapName, false); LoadLevelSceneScript.instance.StartLoadLevel(StaticMapInfo.Level); }
IEnumerator LoadLevel(string levelName, bool res) { StaticMapInfo.SetLevelLoadData(levelName, res); AsyncOperation asyncMaster = SceneManager.LoadSceneAsync("Master"); _levelLoadingUI.SetActive(true); //_isLoading = true; asyncMaster.allowSceneActivation = false; while (asyncMaster.progress < 0.9f) { yield return(null); } asyncMaster.allowSceneActivation = true; }
void Awake() { StaticMapInfo.SetLevelLoadData(LevelName, true); }