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.

162 lines
4.8KB

  1. using System;
  2. using Svelto.ECS.Internal;
  3. namespace Svelto.ECS
  4. {
  5. public interface IReactEngine : IEngine
  6. {
  7. }
  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. /// <summary>
  27. /// This is now considered legacy and it will be deprecated in future
  28. /// </summary>
  29. public interface IReactOnDispose : IReactEngine
  30. {
  31. }
  32. public interface IReactOnAddEx : IReactEngine
  33. {
  34. }
  35. public interface IReactOnRemoveEx : IReactEngine
  36. {
  37. }
  38. public interface IReactOnSwapEx : IReactEngine
  39. {
  40. }
  41. public interface IReactOnDisposeEx : IReactEngine
  42. {
  43. }
  44. }
  45. namespace Svelto.ECS
  46. {
  47. public interface IEngine
  48. {
  49. }
  50. public interface IGetReadyEngine : IEngine
  51. {
  52. //Ready is a callback that can be used to signal that the engine is ready to be used because the entitiesDB is now available
  53. void Ready();
  54. }
  55. public interface IQueryingEntitiesEngine : IGetReadyEngine
  56. {
  57. EntitiesDB entitiesDB { set; }
  58. }
  59. /// <summary>
  60. /// Interface to mark an Engine as reacting on entities added
  61. /// </summary>
  62. /// <typeparam name="T"></typeparam>
  63. [Obsolete]
  64. public interface IReactOnAdd<T> : IReactOnAdd where T : _IInternalEntityComponent
  65. {
  66. void Add(ref T entityComponent, EGID egid);
  67. }
  68. public interface IReactOnAddEx<T> : IReactOnAddEx where T : struct, _IInternalEntityComponent
  69. {
  70. void Add((uint start, uint end) rangeOfEntities, in EntityCollection<T> entities,
  71. ExclusiveGroupStruct groupID);
  72. }
  73. /// <summary>
  74. /// Interface to mark an Engine as reacting on entities removed
  75. /// </summary>
  76. /// <typeparam name="T"></typeparam>
  77. [Obsolete]
  78. public interface IReactOnRemove<T> : IReactOnRemove where T : _IInternalEntityComponent
  79. {
  80. void Remove(ref T entityComponent, EGID egid);
  81. }
  82. public interface IReactOnAddAndRemoveEx<T> : IReactOnAddEx<T>, IReactOnRemoveEx<T> where T : struct, _IInternalEntityComponent
  83. {
  84. }
  85. public interface IReactOnRemoveEx<T> : IReactOnRemoveEx where T : struct, _IInternalEntityComponent
  86. {
  87. void Remove((uint start, uint end) rangeOfEntities, in EntityCollection<T> entities,
  88. ExclusiveGroupStruct groupID);
  89. }
  90. [Obsolete("Use IReactOnAddEx<T> and IReactOnRemoveEx<T> or IReactOnAddAndRemoveEx<T> instead")]
  91. public interface IReactOnAddAndRemove<T> : IReactOnAdd<T>, IReactOnRemove<T> where T : _IInternalEntityComponent
  92. {
  93. }
  94. /// <summary>
  95. /// Interface to mark an Engine as reacting on engines root disposed.
  96. /// It can work together with IReactOnRemove which normally is not called on enginesroot disposed
  97. /// </summary>
  98. /// <typeparam name="T"></typeparam>
  99. [Obsolete("Use IReactOnDisposeEx<T> instead")]
  100. public interface IReactOnDispose<T> : IReactOnDispose where T : _IInternalEntityComponent
  101. {
  102. void Remove(ref T entityComponent, EGID egid);
  103. }
  104. /// <summary>
  105. /// Interface to mark an Engine as reacting to entities swapping group
  106. /// </summary>
  107. /// <typeparam name="T"></typeparam>
  108. [Obsolete("Use IReactOnSwapEx<T> instead")]
  109. public interface IReactOnSwap<T> : IReactOnSwap where T : _IInternalEntityComponent
  110. {
  111. void MovedTo(ref T entityComponent, ExclusiveGroupStruct previousGroup, EGID egid);
  112. }
  113. /// <summary>
  114. /// All the entities have been already submitted in the database (swapped) when this callback is triggered
  115. /// </summary>
  116. /// <typeparam name="T"></typeparam>
  117. public interface IReactOnSwapEx<T> : IReactOnSwapEx where T : struct, _IInternalEntityComponent
  118. {
  119. void MovedTo((uint start, uint end) rangeOfEntities, in EntityCollection<T> entities,
  120. ExclusiveGroupStruct fromGroup, ExclusiveGroupStruct toGroup);
  121. }
  122. public interface IReactOnDisposeEx<T> : IReactOnDisposeEx where T : struct, _IInternalEntityComponent
  123. {
  124. void Remove((uint start, uint end) rangeOfEntities, in EntityCollection<T> entities,
  125. ExclusiveGroupStruct groupID);
  126. }
  127. /// <summary>
  128. /// Interface to mark an Engine as reacting after each entities submission phase
  129. /// </summary>
  130. public interface IReactOnSubmission : IReactEngine
  131. {
  132. void EntitiesSubmitted();
  133. }
  134. public interface IReactOnSubmissionStarted : IReactEngine
  135. {
  136. void EntitiesSubmissionStarting();
  137. }
  138. }