Scene.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. namespace ET
  2. {
  3. public sealed class Scene: Entity
  4. {
  5. public int Zone { get; }
  6. public SceneType SceneType { get; }
  7. public string Name { get; }
  8. public Scene(long id, int zone, SceneType sceneType, string name)
  9. {
  10. this.Id = id;
  11. this.InstanceId = id;
  12. this.Zone = zone;
  13. this.SceneType = sceneType;
  14. this.Name = name;
  15. this.IsCreate = true;
  16. }
  17. public Scene Get(long id)
  18. {
  19. return (Scene)this.Children?[id];
  20. }
  21. public new Entity Domain
  22. {
  23. get
  24. {
  25. return this.domain;
  26. }
  27. set
  28. {
  29. this.domain = value;
  30. }
  31. }
  32. public new Entity Parent
  33. {
  34. get
  35. {
  36. return this.parent;
  37. }
  38. set
  39. {
  40. if (value == null)
  41. {
  42. this.parent = this;
  43. return;
  44. }
  45. this.parent = value;
  46. this.parent.Children.Add(this.Id, this);
  47. #if UNITY_EDITOR
  48. this.ViewGO.transform.SetParent(this.parent.ViewGO.transform, false);
  49. #endif
  50. }
  51. }
  52. }
  53. }