public static void SaveWorld() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = new FileStream(worldPath, FileMode.Create); World_Data data = new World_Data(GameManager.Instance.ChunkManager.NoiseGenerator); bf.Serialize(file, data); file.Close(); }
public static World_Data LoadWorld() { BinaryFormatter bf = new BinaryFormatter(); FileStream fs = new FileStream(worldPath, FileMode.Open); World_Data data = (World_Data)bf.Deserialize(fs); fs.Close(); return(data); }
private void Awake() { if (SaveManager.SaveExist()) { World_Data data = SaveManager.LoadWorld(); Seed = data.Seed; } else { Seed = RandomSeed(); } SetSeed(); }