Scene.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Runtime.CompilerServices;
  2. namespace BansheeEngine
  3. {
  4. /// <summary>
  5. /// Handles operations with the active scene (level).
  6. /// </summary>
  7. public static class Scene
  8. {
  9. /// <summary>
  10. /// Returns the UUID of the scene prefab. This is empty if scene hasn't been saved yet.
  11. /// </summary>
  12. internal static string ActiveSceneUUID { get; set; }
  13. /// <summary>
  14. /// Checks did we make any modifications to the scene since it was last saved.
  15. /// </summary>
  16. /// <returns>True if the scene was never saved, or was modified after last save.</returns>
  17. public static bool IsModified()
  18. {
  19. // TODO - Needs implementing
  20. return true;
  21. }
  22. /// <summary>
  23. /// Clears all scene objects from the current scene.
  24. /// </summary>
  25. public static void Clear()
  26. {
  27. Internal_ClearScene();
  28. ActiveSceneUUID = null;
  29. }
  30. /// <summary>
  31. /// Loads a new scene.
  32. /// </summary>
  33. /// <param name="path">Path to the prefab to load.</param>
  34. public static void Load(string path)
  35. {
  36. Clear();
  37. ActiveSceneUUID = Internal_LoadScene(path);
  38. }
  39. [MethodImpl(MethodImplOptions.InternalCall)]
  40. private static extern string Internal_LoadScene(string path);
  41. [MethodImpl(MethodImplOptions.InternalCall)]
  42. private static extern void Internal_ClearScene();
  43. }
  44. }