From da244dd33ee139939b045283d06f96d9076d2d0a Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 17 Dec 2019 21:02:09 +0100 Subject: [PATCH] added a utility method to get all tiles from a position in tiled --- MLEM.Extended/Tiled/TiledExtensions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MLEM.Extended/Tiled/TiledExtensions.cs b/MLEM.Extended/Tiled/TiledExtensions.cs index 1f502c9..f61a894 100644 --- a/MLEM.Extended/Tiled/TiledExtensions.cs +++ b/MLEM.Extended/Tiled/TiledExtensions.cs @@ -74,6 +74,11 @@ namespace MLEM.Extended.Tiled { return layer != null ? layer.GetTile(x, y) : default; } + public static IEnumerable GetTiles(this TiledMap map, int x, int y) { + foreach (var layer in map.TileLayers) + yield return layer.GetTile(x, y); + } + public static TiledMapTile GetTile(this TiledMapTileLayer layer, int x, int y) { return !layer.IsInBounds(x, y) ? default : layer.GetTile((ushort) x, (ushort) y); }