Esempio n. 1
0
        bool CancelSceneChange(NextScene scene, bool force)
        {
            if ((scene.IsLoadedLevel && !force) ||
                (scene.Equals(nextScene) && !force))
            {
                return(true);
            }

            if (transitionRunning)
            {
                Debug.LogError("A scene transition is already running!", this);
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Loads the requested scene id. Use the force! uhm ... to reload a scene.
        /// </summary>
        public void LoadScene <T>(T scene, bool force) where T : NextScene
        {
            if (loadingScreenController != null && !loadingScreenController.IsInitialized)
            {
                loadingScreenController.Initialize(() => {
                    LoadScene(scene, force);
                });
                return;
            }

            if (CancelSceneChange(scene, force))
            {
                return;
            }

            Debug.Log("Requested " + scene.ToString(), this);

            nextScene = scene;

            animateInDone  = false;
            animateOutDone = false;

            StartCoroutine(SceneChangeCoroutine());
        }
Esempio n. 3
0
        public void LoadScene(string sceneName)
        {
            var scene = new NextScene(sceneName);

            LoadScene <NextScene>(scene, false);
        }
Esempio n. 4
0
        /// <summary>
        /// Loads the scene with the given Index
        /// </summary>
        public void LoadScene(int sceneId)
        {
            var scene = new NextScene(sceneId);

            LoadScene <NextScene>(scene, false);
        }