IEnumerator LoadScene(ScenesIndex targetScene)
        {
            LevelsManager.instance._FadeToBlack();

            while (!UIManager.instance.transitionFinished)
            {
                yield return(null);
            }

            SceneManager.UnloadSceneAsync((int)currentActiveScene);

            loadingSceneOp = SceneManager.LoadSceneAsync((int)targetScene, LoadSceneMode.Additive);

            while (!loadingSceneOp.isDone)
            {
                yield return(null);
            }

            currentActiveScene = targetScene;

            finishedLoadingScene = true;

            while (!UIManager.instance.transitionFinished)
            {
                yield return(null);
            }

            LevelsManager.instance._FadeFromBlack();

            UIManager.instance.RefreshActiveScene();

            yield return(null);

            Debug.Log("Current Active Scene is " + currentActiveScene);
        }
Example #2
0
    public static void LoadScene(ScenesIndex scene)
    {
        sceneToLoad = scene;
        switch (scene)
        {
        case ScenesIndex.Nivel1:
            shouldHaveButton = true;
            break;

        default:
            shouldHaveButton = false;
            break;
        }
        SceneManager.LoadScene((int)ScenesIndex.LoadScreen);
    }
        IEnumerator LoadScene(ScenesIndex targetScene)
        {
            SceneManager.UnloadSceneAsync((int)currentActiveScene);

            loadingSceneOp = SceneManager.LoadSceneAsync((int)targetScene, LoadSceneMode.Additive);

            while (!loadingSceneOp.isDone)
            {
                yield return(null);
            }

            currentActiveScene = targetScene;

            UIManager.instance.RefreshActiveScene();

            yield return(null);
        }
        void Awake()
        {
            if (_instance != null && _instance != this)
            {
                Destroy(this);
            }
            else
            {
                _instance = this;
            }

            if (SceneManager.GetActiveScene().buildIndex == (int)ScenesIndex.LEVEL_EDITOR)
            {
                isLevelEditor = true;
            }
            if (SceneManager.GetActiveScene().name.Contains("DevScene"))
            {
                isDevScene = true;
            }

            SceneManager.LoadSceneAsync((int)ScenesIndex.USER_INTERFACE, LoadSceneMode.Additive);
            loadingSceneOp     = SceneManager.LoadSceneAsync((int)loadToScene, LoadSceneMode.Additive);
            currentActiveScene = loadToScene;
        }
 public void _LoadScene(ScenesIndex targetScene)
 {
     StartCoroutine(LoadScene(targetScene));
 }
 public void _LoadScene(ScenesIndex targetScene)
 {
     finishedLoadingScene = false;
     StartCoroutine(LoadScene(targetScene));
 }