mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 01:39:23 +01:00
add a tiled method to get the index of a layer
This commit is contained in:
parent
7952ba1582
commit
3298608141
1 changed files with 5 additions and 0 deletions
|
@ -52,6 +52,11 @@ namespace MLEM.Extended.Tiled {
|
|||
return tileset?.GetTilesetTile(tile, map);
|
||||
}
|
||||
|
||||
public static int GetTileLayerIndex(this TiledMap map, string layerName) {
|
||||
var layer = map.GetLayer<TiledMapTileLayer>(layerName);
|
||||
return map.TileLayers.IndexOf(layer);
|
||||
}
|
||||
|
||||
public static TiledMapTile GetTile(this TiledMap map, string layerName, int x, int y) {
|
||||
var layer = map.GetLayer<TiledMapTileLayer>(layerName);
|
||||
return layer != null ? layer.GetTile(x, y) : default;
|
||||
|
|
Loading…
Reference in a new issue