LSEntity.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. namespace ET
  3. {
  4. [EnableMethod]
  5. public abstract partial class LSEntity: Entity
  6. {
  7. public new K AddComponent<K>(bool isFromPool = false) where K : LSEntity, IAwake, new()
  8. {
  9. return this.AddComponentWithId<K>(this.GetId(), isFromPool);
  10. }
  11. public new K AddComponent<K, P1>(P1 p1, bool isFromPool = false) where K : LSEntity, IAwake<P1>, new()
  12. {
  13. return this.AddComponentWithId<K, P1>(this.GetId(), p1, isFromPool);
  14. }
  15. public new K AddComponent<K, P1, P2>(P1 p1, P2 p2, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2>, new()
  16. {
  17. return this.AddComponentWithId<K, P1, P2>(this.GetId(), p1, p2, isFromPool);
  18. }
  19. public new K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2, P3>, new()
  20. {
  21. return this.AddComponentWithId<K, P1, P2, P3>(this.GetId(), p1, p2, p3, isFromPool);
  22. }
  23. [EnableAccessEntiyChild]
  24. public new T AddChild<T>(bool isFromPool = false) where T : LSEntity, IAwake
  25. {
  26. return this.AddChildWithId<T>(this.GetId(), isFromPool);
  27. }
  28. [EnableAccessEntiyChild]
  29. public new T AddChild<T, A>(A a, bool isFromPool = false) where T : LSEntity, IAwake<A>
  30. {
  31. return this.AddChildWithId<T, A>(this.GetId(), a, isFromPool);
  32. }
  33. [EnableAccessEntiyChild]
  34. public new T AddChild<T, A, B>(A a, B b, bool isFromPool = false) where T : LSEntity, IAwake<A, B>
  35. {
  36. return this.AddChildWithId<T, A, B>(this.GetId(), a, b, isFromPool);
  37. }
  38. [EnableAccessEntiyChild]
  39. public new T AddChild<T, A, B, C>(A a, B b, C c, bool isFromPool = false) where T : LSEntity, IAwake<A, B, C>
  40. {
  41. return this.AddChildWithId<T, A, B, C>(this.GetId(), a, b, c, isFromPool);
  42. }
  43. protected override void RegisterSystem()
  44. {
  45. LSWorld lsWorld = (LSWorld)this.IScene;
  46. TypeSystems.OneTypeSystems oneTypeSystems = LSEntitySystemSingleton.Instance.GetOneTypeSystems(this.GetType());
  47. if (oneTypeSystems == null)
  48. {
  49. return;
  50. }
  51. if (oneTypeSystems.QueueFlag[LSQueneUpdateIndex.LSUpdate])
  52. {
  53. lsWorld.RegisterSystem(this);
  54. }
  55. }
  56. }
  57. }