LSEntity.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. namespace ET
  3. {
  4. [EnableMethod]
  5. public 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. public new T AddChild<T>(bool isFromPool = false) where T : LSEntity, IAwake
  24. {
  25. return this.AddChildWithId<T>(this.GetId(), isFromPool);
  26. }
  27. public new T AddChild<T, A>(A a, bool isFromPool = false) where T : LSEntity, IAwake<A>
  28. {
  29. return this.AddChildWithId<T, A>(this.GetId(), a, isFromPool);
  30. }
  31. public new T AddChild<T, A, B>(A a, B b, bool isFromPool = false) where T : LSEntity, IAwake<A, B>
  32. {
  33. return this.AddChildWithId<T, A, B>(this.GetId(), a, b, isFromPool);
  34. }
  35. public new T AddChild<T, A, B, C>(A a, B b, C c, bool isFromPool = false) where T : LSEntity, IAwake<A, B, C>
  36. {
  37. return this.AddChildWithId<T, A, B, C>(this.GetId(), a, b, c, isFromPool);
  38. }
  39. protected override void RegisterSystem()
  40. {
  41. LSWorld lsWorld = this.LSWorld();
  42. TypeSystems.OneTypeSystems oneTypeSystems = LSSington.Instance.GetOneTypeSystems(this.GetType());
  43. if (oneTypeSystems == null)
  44. {
  45. return;
  46. }
  47. if (oneTypeSystems.QueueFlag[LSQueneUpdateIndex.LSUpdate])
  48. {
  49. lsWorld.AddToUpdater(this);
  50. }
  51. }
  52. }
  53. }