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.

130 lines
3.6KB

  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 : IEntityComponent
  58. {
  59. void Add(ref T entityComponent, EGID egid);
  60. }
  61. public interface IReactOnAddEx<T> : IReactOnAddEx where T : struct, IEntityComponent
  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 : IEntityComponent
  71. {
  72. void Remove(ref T entityComponent, EGID egid);
  73. }
  74. public interface IReactOnRemoveEx<T> : IReactOnRemoveEx where T : struct, IEntityComponent
  75. {
  76. void Remove((uint start, uint end) rangeOfEntities, in EntityCollection<T> collection,
  77. ExclusiveGroupStruct groupID);
  78. }
  79. public interface IReactOnAddAndRemove<T> : IReactOnAdd<T>, IReactOnRemove<T> where T : IEntityComponent
  80. {
  81. }
  82. /// <summary>
  83. /// Interface to mark an Engine as reacting on engines root disposed.
  84. /// It can work together with IReactOnRemove which normally is not called on enginesroot disposed
  85. /// </summary>
  86. /// <typeparam name="T"></typeparam>
  87. public interface IReactOnDispose<T> : IReactOnDispose where T : IEntityComponent
  88. {
  89. void Remove(ref T entityComponent, EGID egid);
  90. }
  91. /// <summary>
  92. /// Interface to mark an Engine as reacting to entities swapping group
  93. /// </summary>
  94. /// <typeparam name="T"></typeparam>
  95. public interface IReactOnSwap<T> : IReactOnSwap where T : IEntityComponent
  96. {
  97. void MovedTo(ref T entityComponent, ExclusiveGroupStruct previousGroup, EGID egid);
  98. }
  99. public interface IReactOnSwapEx<T> : IReactOnSwapEx where T : struct, IEntityComponent
  100. {
  101. void MovedTo((uint start, uint end) rangeOfEntities, in EntityCollection<T> collection,
  102. ExclusiveGroupStruct fromGroup, ExclusiveGroupStruct toGroup);
  103. }
  104. /// <summary>
  105. /// Interface to mark an Engine as reacting after each entities submission phase
  106. /// </summary>
  107. public interface IReactOnSubmission : IReactEngine
  108. {
  109. void EntitiesSubmitted();
  110. }
  111. }