Game.cs 929 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. namespace ETModel
  2. {
  3. public static class Game
  4. {
  5. private static Scene scene;
  6. public static Scene Scene
  7. {
  8. get
  9. {
  10. if (scene != null)
  11. {
  12. return scene;
  13. }
  14. scene = new Scene();
  15. scene.GameObject.transform.SetParent(scene.GameObject.transform.Find("/Global"));
  16. return scene;
  17. }
  18. }
  19. private static EventSystem eventSystem;
  20. public static EventSystem EventSystem
  21. {
  22. get
  23. {
  24. return eventSystem ?? (eventSystem = new EventSystem());
  25. }
  26. }
  27. private static ObjectPool objectPool;
  28. public static ObjectPool ObjectPool
  29. {
  30. get
  31. {
  32. return objectPool ?? (objectPool = new ObjectPool());
  33. }
  34. }
  35. private static Hotfix hotfix;
  36. public static Hotfix Hotfix
  37. {
  38. get
  39. {
  40. return hotfix ?? (hotfix = new Hotfix());
  41. }
  42. }
  43. public static void Close()
  44. {
  45. scene.Dispose();
  46. eventSystem = null;
  47. scene = null;
  48. objectPool = null;
  49. hotfix = null;
  50. }
  51. }
  52. }