Example #1
0
 /// <summary>
 /// Changes to the scene with the given id
 /// </summary>
 /// <param name="id"></param>
 public void ChangeScene(int id)
 {
     if (id >= 0 && id < scenes.Count)
     {
         if (currentScene != null)
         {
             // Call the current scene's leave method
             currentScene.Leave();
             ConsoleManager.Instance.WriteLine($"SceneManager: Changed scene '{currentScene.SceneName}' with '{scenes[id].SceneName}'", MsgType.Info);
         }
         else
         {
             ConsoleManager.Instance.WriteLine($"SceneManager: Changed scene to '{scenes[id].SceneName}'", MsgType.Info);
         }
         // Call the new scene's enter method
         scenes[id].Enter();
         // update the current scene reference
         currentScene = scenes[id];
     }
 }
Example #2
0
 /// <summary>
 /// Registers the given scene so it can be switched to
 /// </summary>
 /// <param name="scene"></param>
 public void RegisterScene(BaseScene scene)
 {
     scene.SceneID = scenes.Count;
     scenes.Add(scene);
 }