public void Load(SceneLoadedCallback onLoadedCallback, object passedParams)
        {
            EditorStateParams loadParams = (EditorStateParams)passedParams;

            modeManager = Service.EditorModeManager;
            modeManager.SwitchToMode(EditorMode.Build);
            onLoadedCallback();
        }
Example #2
0
    /**
     * <summary>
     * Loads any scene by its name. Note however that this bypasses passing any required parameters to scenes.
     * The scene must be added and enabled in the BuildSettings dialog.
     * </summary>
     * <param name="sceneName">
     *     name of the scene to load. May also be a relative path to a scene as shown in the BuildSettings window. (relative to the "Assets" folder and without file extension.
     * </param>
     * <param name="transitionType">
     *     the animation to play when changing scenes (optional)
     * </param>
     * <param name="callback">
     *     callback to invoke, when the new scene has finished loading (optional)
     * </param>
     */
    public void LoadSceneByName(string sceneName, TransitionType transitionType = TransitionType.None, SceneLoadedCallback callback = null)
    {
        _onSceneLoadedCallback = callback;
        _transitionType        = transitionType;

        // Play animation to transition out of the current scene
        TransitionController.Instance.TransitionOutOfScene(transitionType, () =>
        {
            // When the animation completed, load the new scene
            IsLoadingScene = true;

            SceneManager.LoadScene(sceneName);
        });
    }
Example #3
0
        public void LoadScene <T>(SceneLoadedCallback callback, object passedParams) where T : IStateController, new()
        {
            onNewSceneLoaded = callback;

            //Don't show transition screen if it's our first load.
            if (!isTransitionDone)
            {
                m_transitionScreen.SetActive(true);
                m_transitionScreen.PlayTransitionOut(onTransitionShown);
            }

            newScene = new T();
            newScene.Load(onSceneLoaded, passedParams);
        }
Example #4
0
        SceneLoadedCallbackCoroutine
            (SceneIndex sceneIndex, SceneLoadedCallback callback)
        {
            lock (SceneLoadLock)
            {
                SceneLoadInProgress = true;
                AsyncOperation SceneLoad
                    = SceneManager.LoadSceneAsync((int)sceneIndex, LoadSceneMode.Additive);
                ConfirmSceneLoadNotNull(sceneIndex, SceneLoad);
                yield return(new WaitUntil(() => SceneLoad.isDone));

                SceneLoadInProgress = false;
                callback();
            }
        }
Example #5
0
 public void AddCallbackAfterLoaded(SceneLoadedCallback newCallback)
 {
     m_callback += newCallback;
 }
Example #6
0
 public void AddOnlyOnceCallbackAfterLoaded(SceneLoadedCallback newCallback)
 {
     m_onlyOnceCallback += newCallback;
 }