Exemplo n.º 1
0
    public void LoadMap()
    {
        fieldScript.ClearMap();
        string path = Application.persistentDataPath + "/map.mp";

        if (File.Exists(path))
        {
            BinaryFormatter bf     = new BinaryFormatter();
            FileStream      stream = new FileStream(path, FileMode.Open);

            MapData mapData = bf.Deserialize(stream) as MapData;
            Debug.Log("Mapdata size: " + mapData.tiles.Count);
            fieldScript.DrawTilesFromMap(mapData);
            stream.Close();
            fieldScript.SetNeighbours();
        }
        else
        {
            Debug.Log("No file found");
        }
    }