1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public static bool LoadAll()
{
Debug.Log("Loading terrains");
string filePath = "./Assets/Tilesets/Terrains.ter";
Stream stream;
try
{
stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
}
catch (IOException ioe)
{
Debug.Log("IOException : " + ioe.GetType().Name + " filePath : " + filePath);
return false;
}
BinaryFormatter bFormatter = new BinaryFormatter();
TileSetTerrain.terrains = (List<TileSetTerrain>)bFormatter.Deserialize(stream);
stream.Close();
Debug.Log("Terrains loaded");
return true;
} |
Partager