예제 #1
0
    public void Build()
    {
        TileMap      tilemap = TmxParser.Parser(Application.dataPath + TmxFileRelativePath);
        List <Layer> layers  = tilemap.Layers;

        int index = 0;

        for (int i = 0; i < layers.Count; i++)
        {
            Layer layer = layers[i];
            if (layer.GetType() == typeof(TileSetLayer))
            {
                TileLayerRenderer tilelayer = Instantiate(Prefab);
                tilelayer.transform.position  = new Vector3(transform.position.x, transform.position.y, -index);
                tilelayer.TmxFileRelativePath = TmxFileRelativePath;
                tilelayer.FilterMode          = FilterMode;
                tilelayer.WrapMode            = WrapMode;
                tilelayer.TileSet             = TileSet;
                tilelayer.IndexLayer          = index;
                tilelayer.transform.parent    = transform;
                index++;
            }
            else if (layer.GetType() == typeof(ObjectGroupLayer))
            {
                // TODO
            }
            else if (layer.GetType() == typeof(ImageLayer))
            {
                // TODO
            }
        }
    }
예제 #2
0
 private void ReadTmxFile()
 {
     Debug.Log("> Read Tmx File [" + Application.dataPath + TmxFileRelativePath + "]");
     tileMap        = TmxParser.Parser(Application.dataPath + TmxFileRelativePath);
     numberTilesX   = tileMap.Width;
     numberTilesY   = tileMap.Height;
     tileResolution = tileMap.TileWidth;
 }