IUpdateSystem.cs 586 B

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