コード例 #1
0
    public void RequestLoadScene (string sceneName, bool activateWhenReady)
    {
        var task = new SceneControlTask ();
        task.SceneName = sceneName;
        task.SceneControlMode = ESceneControlMode.Load;
        task.ActivateWhenReady = activateWhenReady;

        m_taskQueue.Enqueue (task);
    }
コード例 #2
0
    public void RequestUnloadScene (string sceneName)
    {
        var task = new SceneControlTask ();
        task.SceneName = sceneName;
        task.SceneControlMode = ESceneControlMode.Unload;
        task.ActivateWhenReady = true;

        m_taskQueue.Enqueue (task);
    }
コード例 #3
0
    private IEnumerator SceneUnloadCoroutine (SceneControlTask task)
    {
        var sceneName = task.SceneName;
        var async = SceneManager.UnloadSceneAsync (sceneName);
        async.allowSceneActivation = task.ActivateWhenReady;

        OnUnloadStartEventDictionary.GetEvent (sceneName).Invoke ();

        while (async.isDone == false)
        {
            float progress = async.progress;

            OnUnloadingEventDictionary.GetEvent (sceneName).Invoke (progress);

            yield return null;
        }
    }
コード例 #4
0
    private IEnumerator SceneLoadCoroutine (SceneControlTask task)
    {
        var sceneName = task.SceneName;
        var async = SceneManager.LoadSceneAsync (sceneName, LoadSceneMode.Additive);
        async.allowSceneActivation = task.ActivateWhenReady;

        OnLoadStartEventDictionary.GetEvent (sceneName).Invoke ();

        while (async.isDone == false)
        {
            float progress = async.progress;
            bool bReady = progress >= 0.9f;

            OnLoadingEventDictionary.GetEvent (sceneName).Invoke (progress, bReady);

            yield return null;
        }

        OnLoadEndEventDictionary.GetEvent (sceneName).Invoke ();
    }