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.

148 lines
4.1KB

  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 IReactOnDispose : IReactEngine
  38. {
  39. }
  40. }
  41. namespace Svelto.ECS
  42. {
  43. public interface IEngine
  44. {
  45. }
  46. public interface IGetReadyEngine : IEngine
  47. {
  48. void Ready();
  49. }
  50. public interface IQueryingEntitiesEngine : IGetReadyEngine
  51. {
  52. EntitiesDB entitiesDB { set; }
  53. }
  54. /// <summary>
  55. /// Interface to mark an Engine as reacting on entities added
  56. /// </summary>
  57. /// <typeparam name="T"></typeparam>
  58. [Obsolete]
  59. public interface IReactOnAdd<T> : IReactOnAdd where T : _IInternalEntityComponent
  60. {
  61. void Add(ref T entityComponent, EGID egid);
  62. }
  63. public interface IReactOnAddEx<T> : IReactOnAddEx where T : struct, _IInternalEntityComponent
  64. {
  65. void Add((uint start, uint end) rangeOfEntities, in EntityCollection<T> entities,
  66. ExclusiveGroupStruct groupID);
  67. }
  68. /// <summary>
  69. /// Interface to mark an Engine as reacting on entities removed
  70. /// </summary>
  71. /// <typeparam name="T"></typeparam>
  72. [Obsolete]
  73. public interface IReactOnRemove<T> : IReactOnRemove where T : _IInternalEntityComponent
  74. {
  75. void Remove(ref T entityComponent, EGID egid);
  76. }
  77. public interface IReactOnAddAndRemoveEx<T> : IReactOnAddEx<T>, IReactOnRemoveEx<T> where T : struct, _IInternalEntityComponent
  78. {
  79. }
  80. public interface IReactOnRemoveEx<T> : IReactOnRemoveEx where T : struct, _IInternalEntityComponent
  81. {
  82. void Remove((uint start, uint end) rangeOfEntities, in EntityCollection<T> entities,
  83. ExclusiveGroupStruct groupID);
  84. }
  85. [Obsolete]
  86. public interface IReactOnAddAndRemove<T> : IReactOnAdd<T>, IReactOnRemove<T> where T : _IInternalEntityComponent
  87. {
  88. }
  89. /// <summary>
  90. /// Interface to mark an Engine as reacting on engines root disposed.
  91. /// It can work together with IReactOnRemove which normally is not called on enginesroot disposed
  92. /// </summary>
  93. /// <typeparam name="T"></typeparam>
  94. public interface IReactOnDispose<T> : IReactOnDispose where T : _IInternalEntityComponent
  95. {
  96. void Remove(ref T entityComponent, EGID egid);
  97. }
  98. /// <summary>
  99. /// Interface to mark an Engine as reacting to entities swapping group
  100. /// </summary>
  101. /// <typeparam name="T"></typeparam>
  102. [Obsolete]
  103. public interface IReactOnSwap<T> : IReactOnSwap where T : _IInternalEntityComponent
  104. {
  105. void MovedTo(ref T entityComponent, ExclusiveGroupStruct previousGroup, EGID egid);
  106. }
  107. /// <summary>
  108. /// All the entities have been already submitted in the database (swapped) when this callback is triggered
  109. /// </summary>
  110. /// <typeparam name="T"></typeparam>
  111. public interface IReactOnSwapEx<T> : IReactOnSwapEx where T : struct, _IInternalEntityComponent
  112. {
  113. void MovedTo((uint start, uint end) rangeOfEntities, in EntityCollection<T> entities,
  114. ExclusiveGroupStruct fromGroup, ExclusiveGroupStruct toGroup);
  115. }
  116. /// <summary>
  117. /// Interface to mark an Engine as reacting after each entities submission phase
  118. /// </summary>
  119. public interface IReactOnSubmission : IReactEngine
  120. {
  121. void EntitiesSubmitted();
  122. }
  123. public interface IReactOnSubmissionStarted : IReactEngine
  124. {
  125. void EntitiesSubmissionStarting();
  126. }
  127. }