Example #1
0
 public void AddScene(AbstractScene scene)
 {
     if (scenes.ContainsKey(scene.GetName()))
     {
         throw new Exception("Scene name already exists!");
     }
     scenes.Add(scene.GetName(), scene);
     scene.Camera = camera;
     scene.SetSceneManager(this);
     if (scene.Preload)
     {
         scene.InternalLoad();
     }
 }
Example #2
0
        private void LoadNextScene()
        {
            ICollection <object> data = null;

            if (currentScene != null)
            {
                data = currentScene.ExportData();
                currentScene.OnEnd();
                currentScene.Unload();
                if (!currentScene.AlwaysActive)
                {
                    activeScenes.RemoveIfExists(currentScene);
                }
            }
            currentScene    = nextSceneToLoad;
            nextSceneToLoad = null;
            activeScenes.AddIfMissing(currentScene);
            currentScene.InternalLoad();
            currentScene.ImportData(data);
            currentScene.OnStart();
            isLoading        = false;
            useLoadingScreen = false;
        }