From 3298608141881ecbba23a0fc8383c64e019b656b Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 7 Dec 2019 12:56:01 +0100 Subject: [PATCH] add a tiled method to get the index of a layer --- 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 edd08e1..d9b7188 100644 --- a/MLEM.Extended/Tiled/TiledExtensions.cs +++ b/MLEM.Extended/Tiled/TiledExtensions.cs @@ -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(layerName); + return map.TileLayers.IndexOf(layer); + } + public static TiledMapTile GetTile(this TiledMap map, string layerName, int x, int y) { var layer = map.GetLayer(layerName); return layer != null ? layer.GetTile(x, y) : default;