1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 04:53:29 +01:00

added a utility method to get all tiles from a position in tiled

This commit is contained in:
Ellpeck 2019-12-17 21:02:09 +01:00
parent 8dcf3d8e63
commit da244dd33e

View file

@ -74,6 +74,11 @@ namespace MLEM.Extended.Tiled {
return layer != null ? layer.GetTile(x, y) : default;
}
public static IEnumerable<TiledMapTile> 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);
}