UnitComponentSystem.cs 804 B

1234567891011121314151617181920212223242526272829303132333435
  1. namespace ET
  2. {
  3. [ObjectSystem]
  4. public class UnitComponentAwakeSystem : AwakeSystem<UnitComponent>
  5. {
  6. protected override void Awake(UnitComponent self)
  7. {
  8. UnitComponent.Instance = self;
  9. }
  10. }
  11. [ObjectSystem]
  12. public class UnitComponentDestroySystem : DestroySystem<UnitComponent>
  13. {
  14. protected override void Destroy(UnitComponent self)
  15. {
  16. }
  17. }
  18. [FriendOfAttribute(typeof(ET.UnitComponent))]
  19. public static class UnitComponentSystem
  20. {
  21. public static Unit Get(this UnitComponent self, long id)
  22. {
  23. Unit unit = self.GetChild<Unit>(id);
  24. return unit;
  25. }
  26. public static void Remove(this UnitComponent self, long id)
  27. {
  28. Unit unit = self.GetChild<Unit>(id);
  29. unit?.Dispose();
  30. }
  31. }
  32. }