Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IEngine.cs 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using Svelto.ECS.Internal;
  2. namespace Svelto.ECS.Internal
  3. {
  4. public interface IReactEngine : IEngine
  5. {
  6. }
  7. #region legacy interfaces
  8. /// <summary>
  9. /// This is now considered legacy and it will be deprecated in future
  10. /// </summary>
  11. public interface IReactOnAdd : IReactEngine
  12. {
  13. }
  14. /// <summary>
  15. /// This is now considered legacy and it will be deprecated in future
  16. /// </summary>
  17. public interface IReactOnRemove : IReactEngine
  18. {
  19. }
  20. /// <summary>
  21. /// This is now considered legacy and it will be deprecated in future
  22. /// </summary>
  23. public interface IReactOnSwap : IReactEngine
  24. {
  25. }
  26. #endregion
  27. public interface IReactOnAddEx : IReactEngine
  28. {
  29. }
  30. public interface IReactOnRemoveEx : IReactEngine
  31. {
  32. }
  33. public interface IReactOnSwapEx : IReactEngine
  34. {
  35. }
  36. public interface IReactOnDispose : IReactEngine
  37. {
  38. }
  39. }
  40. namespace Svelto.ECS
  41. {
  42. public interface IEngine
  43. {
  44. }
  45. public interface IGetReadyEngine : IEngine
  46. {
  47. void Ready();
  48. }
  49. public interface IQueryingEntitiesEngine : IGetReadyEngine
  50. {
  51. EntitiesDB entitiesDB { set; }
  52. }
  53. /// <summary>
  54. /// Interface to mark an Engine as reacting on entities added
  55. /// </summary>
  56. /// <typeparam name="T"></typeparam>
  57. public interface IReactOnAdd<T> : IReactOnAdd where T : IBaseEntityComponent
  58. {
  59. void Add(ref T entityComponent, EGID egid);
  60. }
  61. public interface IReactOnAddEx<T> : IReactOnAddEx where T : struct, IBaseEntityComponent
  62. {
  63. void Add((uint start, uint end) rangeOfEntities, in EntityCollection<T> collection,
  64. ExclusiveGroupStruct groupID);
  65. }
  66. /// <summary>
  67. /// Interface to mark an Engine as reacting on entities removed
  68. /// </summary>
  69. /// <typeparam name="T"></typeparam>
  70. public interface IReactOnRemove<T> : IReactOnRemove where T : IBaseEntityComponent
  71. {
  72. void Remove(ref T entityComponent, EGID egid);
  73. }
  74. public interface IReactOnAddAndRemoveEx<T> : IReactOnAddEx<T>, IReactOnRemoveEx<T> where T : struct, IBaseEntityComponent
  75. {
  76. }
  77. public interface IReactOnRemoveEx<T> : IReactOnRemoveEx where T : struct, IBaseEntityComponent
  78. {
  79. void Remove((uint start, uint end) rangeOfEntities, in EntityCollection<T> collection,
  80. ExclusiveGroupStruct groupID);
  81. }
  82. public interface IReactOnAddAndRemove<T> : IReactOnAdd<T>, IReactOnRemove<T> where T : IBaseEntityComponent
  83. {
  84. }
  85. /// <summary>
  86. /// Interface to mark an Engine as reacting on engines root disposed.
  87. /// It can work together with IReactOnRemove which normally is not called on enginesroot disposed
  88. /// </summary>
  89. /// <typeparam name="T"></typeparam>
  90. public interface IReactOnDispose<T> : IReactOnDispose where T : IBaseEntityComponent
  91. {
  92. void Remove(ref T entityComponent, EGID egid);
  93. }
  94. /// <summary>
  95. /// Interface to mark an Engine as reacting to entities swapping group
  96. /// </summary>
  97. /// <typeparam name="T"></typeparam>
  98. public interface IReactOnSwap<T> : IReactOnSwap where T : IBaseEntityComponent
  99. {
  100. void MovedTo(ref T entityComponent, ExclusiveGroupStruct previousGroup, EGID egid);
  101. }
  102. public interface IReactOnSwapEx<T> : IReactOnSwapEx where T : struct, IBaseEntityComponent
  103. {
  104. void MovedTo((uint start, uint end) rangeOfEntities, in EntityCollection<T> collection,
  105. ExclusiveGroupStruct fromGroup, ExclusiveGroupStruct toGroup);
  106. }
  107. /// <summary>
  108. /// Interface to mark an Engine as reacting after each entities submission phase
  109. /// </summary>
  110. public interface IReactOnSubmission : IReactEngine
  111. {
  112. void EntitiesSubmitted();
  113. }
  114. }