Beispiel #1
0
    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);
    }
Beispiel #2
0
 /// <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"));
 }
Beispiel #3
0
 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);
 }
Beispiel #4
0
    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;
    }
Beispiel #5
0
 void Awake()
 {
     StaticMapInfo.SetLevelLoadData(LevelName, true);
 }