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.

158 lines
4.5KB

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