ISpaceAlgorithm.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections.Generic;
  2. namespace MonoGame.Extended.Collisions;
  3. /// <summary>
  4. /// Interface, which split space for optimization of collisions.
  5. /// </summary>
  6. public interface ISpaceAlgorithm
  7. {
  8. /// <summary>
  9. /// Inserts the actor into the space.
  10. /// The actor will have its OnCollision called when collisions occur.
  11. /// </summary>
  12. /// <param name="actor">Actor to insert.</param>
  13. void Insert(ICollisionActor actor);
  14. /// <summary>
  15. /// Removes the actor into the space.
  16. /// </summary>
  17. /// <param name="actor">Actor to remove.</param>
  18. bool Remove(ICollisionActor actor);
  19. /// <summary>
  20. /// Removes the actor into the space.
  21. /// The actor will have its OnCollision called when collisions occur.
  22. /// </summary>
  23. /// <param name="actor">Actor to remove.</param>
  24. IEnumerable<ICollisionActor> Query(RectangleF boundsBoundingRectangle);
  25. /// <summary>
  26. /// for foreach
  27. /// </summary>
  28. /// <returns></returns>
  29. List<ICollisionActor>.Enumerator GetEnumerator();
  30. /// <summary>
  31. /// Restructure the space with new positions.
  32. /// </summary>
  33. void Reset();
  34. }