public cTile GetTileAtIndex(int index, int layer = TileLayerTypes.WALLS) { if (index >= 0 && index < NumOfTiles) { return(layers[layer][index]); } else { int index2 = AppMath.Clamp <int>(index, 0, NumOfTiles - 1); return(layers[layer][index2]); } }