public void FromJson(GridJson json) { Version++; _tileSize = json.size; _width = json.heightMap.GetLength(0); _height = json.heightMap.GetLength(1); if (_width != json.tileMap.GetLength(0) || _height != json.tileMap.GetLength(1)) { } _heightMap = new GridObject<byte>(json.heightMap); _tileMap = new GridObject<short>(json.tileMap); _visitedMap = new bool[_width, _height]; _sightMap = null; }
public static void ToFile(string file, GridJson grid) { string str = JsonConvert.SerializeObject(grid); File.WriteAllText(file, str); }