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:
parent
8dcf3d8e63
commit
da244dd33e
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue