diff --git a/MLEM.Extended/Tiled/TiledMapCollisions.cs b/MLEM.Extended/Tiled/TiledMapCollisions.cs
index 91cad36..b081209 100644
--- a/MLEM.Extended/Tiled/TiledMapCollisions.cs
+++ b/MLEM.Extended/Tiled/TiledMapCollisions.cs
@@ -112,30 +112,38 @@ namespace MLEM.Extended.Tiled {
}
///
- /// Returns a set of normals and penetration amounts for each that intersects with the given area.
+ /// Returns an enumerable of all of the of the colliding tiles in the given area.
+ /// This method is a convenience method based on .
+ ///
+ /// The area to check for collisions in
+ /// A function that determines if a certain info should be included or not
+ /// An enumerable of collision rectangles for that area
+ public IEnumerable GetCollidingAreas(RectangleF area, Func included = null) {
+ foreach (var tile in this.GetCollidingTiles(area, included)) {
+ foreach (var col in tile.Collisions)
+ yield return col;
+ }
+ }
+
+ ///
+ /// Returns an enumerable of normals and penetration amounts for each that intersects with the given area.
/// The normals and penetration amounts are based on .
/// Note that all x penetrations are returned before all y penetrations, which improves collision detection in sidescrolling games with gravity.
///
/// The area to penetrate
+ /// A function that determines if a certain info should be included or not
/// A set of normals and penetration amounts
- public IEnumerable<(Vector2, float)> GetPenetrations(Func getArea) {
- foreach (var col in this.GetCollidingAreas(getArea())) {
+ public IEnumerable<(Vector2, float)> GetPenetrations(Func getArea, Func included = null) {
+ foreach (var col in this.GetCollidingAreas(getArea(), included)) {
if (getArea().Penetrate(col, out var normal, out var penetration) && normal.X != 0)
yield return (normal, penetration);
}
- foreach (var col in this.GetCollidingAreas(getArea())) {
+ foreach (var col in this.GetCollidingAreas(getArea(), included)) {
if (getArea().Penetrate(col, out var normal, out var penetration) && normal.Y != 0)
yield return (normal, penetration);
}
}
- private IEnumerable GetCollidingAreas(RectangleF area, Func included = null) {
- foreach (var tile in this.GetCollidingTiles(area, included)) {
- foreach (var col in tile.Collisions)
- yield return col;
- }
- }
-
///
/// A delegate method used to override the default collision checking behavior.
///