コード例 #1
0
    /// <summary>
    /// Reads the json content from the passed in path found in the resources folder
    /// Constructs a new TileResourceLoader object that stores the information for each type of tile
    /// </summary>
    /// <param name="path"> The path to the json file relative to the Resource folder</param>
    /// <returns>The data for the map including the tile assets and data for each grid position</returns>
    protected MapData ReadMapData(string path)
    {
        using (StreamReader r = new StreamReader(path))
        {
            string  json       = r.ReadToEnd();
            MapData loadedData = JsonUtility.FromJson <MapData>(json);
            _loader = new TileResourceLoader(loadedData.Path);
            return(loadedData);
        }

        //TextAsset jsonFile = (TextAsset)Resources.Load(path, typeof(TextAsset));
        //MapData loadedData = JsonUtility.FromJson<MapData>(jsonFile.text);
    }
コード例 #2
0
 protected void LoadTileSet(string path) => _loader = new TileResourceLoader(path);