IAddComponentSystem.cs 703 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. namespace ET
  3. {
  4. public interface IAddComponent
  5. {
  6. }
  7. public interface IAddComponentSystem: ISystemType
  8. {
  9. void Run(Entity o, Entity component);
  10. }
  11. [ObjectSystem]
  12. public abstract class AddComponentSystem<T> : IAddComponentSystem where T: Entity, IAddComponent
  13. {
  14. void IAddComponentSystem.Run(Entity o, Entity component)
  15. {
  16. this.AddComponent((T)o, component);
  17. }
  18. Type ISystemType.SystemType()
  19. {
  20. return typeof(IAddComponentSystem);
  21. }
  22. InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
  23. {
  24. return InstanceQueueIndex.None;
  25. }
  26. Type ISystemType.Type()
  27. {
  28. return typeof(T);
  29. }
  30. protected abstract void AddComponent(T self, Entity component);
  31. }
  32. }