Exemple #1
0
    IEnumerator LoadSubLevelCoroutine(string sceneName, CConnectPoint point = null)
    {
        yield return(null);

        AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);

        if (operation == null)
        {
            yield break;
        }

        operation.allowSceneActivation = false;

        while (!operation.isDone)
        {
            yield return(null);

            if (operation.progress >= 0.9f)
            {
                operation.allowSceneActivation = true;
                if (point != null)
                {
                    point.ColliderModeChange();
                }
            }
        }

        yield return(null);
    }
Exemple #2
0
    public void LoadSubLevel(int nSubIdx, CConnectPoint point = null)
    {
        string subSceneName = m_rootName + nSubIdx;

        Scene?scene = SceneManager.GetSceneByName(subSceneName);

        if (scene == null)
        {
            Debug.LogError(subSceneName + "is not contained all Levels");
            return;
        }

        if (!SceneManager.GetSceneByName(subSceneName).isLoaded)
        {
            StartCoroutine(LoadSubLevelCoroutine(subSceneName, point));
        }
    }