public ETileType GetTileType(Vector3Int position) { if (mapRoot == null) { return(ETileType.Unreachable); } var t = tileLayer.GetTile(position) as SuperTiled2Unity.SuperTile; if (t == null) { return(ETileType.Unreachable); } var tileType = FeTileInfo.FromString(t.m_Type); return(tileType); }
public void InitTileTypeData() { var superMapInfo = mapRoot.GetComponent <SuperTiled2Unity.SuperMap>(); mapSize = new Vector2Int(superMapInfo.m_Width, superMapInfo.m_Height); mapTileType = new ETileType[mapSize.x, mapSize.y]; for (int i = 0; i < mapSize.x; i++) { for (int j = 0; j < mapSize.y; j++) { var t = tileLayer.GetTile(PositionMath.TilePositionToGridPosition(new Vector2Int(i, j))) as SuperTiled2Unity.SuperTile; mapTileType[i, j] = FeTileInfo.FromString(t.m_Type); } } PositionMath.SetTileTypeData(mapTileType); }