using Godot; namespace ColdMint.scripts.utils; public static class TileMapUtils { /// /// Get the layer number corresponding to LayerName in TileMap /// 在TileMap内获取LayerName所对应的图层序号 /// /// /// /// ///− 1 is returned after obtaining failure ///获取失败返回-1 /// public static int GetTileMapLayer(TileMap tileMap, string layerName) { var count = tileMap.GetLayersCount(); for (var i = 0; i < count; i++) { var currentLayerName = tileMap.GetLayerName(i); if (currentLayerName == layerName) { return i; } } return -1; } }