1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- namespace ET
- {
- [ObjectSystem]
- public class UnitComponentAwakeSystem : AwakeSystem<UnitComponent>
- {
- protected override void Awake(UnitComponent self)
- {
- }
- }
-
- [ObjectSystem]
- public class UnitComponentDestroySystem : DestroySystem<UnitComponent>
- {
- protected override void Destroy(UnitComponent self)
- {
- }
- }
- [FriendOfAttribute(typeof(ET.UnitComponent))]
- public static class UnitComponentSystem
- {
- public static void Add(this UnitComponent self, Unit unit)
- {
- if (unit.IsActor)
- {
- self.IDActor = unit.Id;
- }
- }
- public static Unit GetActor(this UnitComponent self)
- {
- return self.GetChild<Unit>(self.IDActor);
- }
- public static Unit Get(this UnitComponent self, long id)
- {
- Unit unit = self.GetChild<Unit>(id);
- return unit;
- }
- public static void Remove(this UnitComponent self, long id)
- {
- Unit unit = self.GetChild<Unit>(id);
- unit?.Dispose();
- }
- }
- }
|