Exemple #1
0
    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();
    }
Exemple #2
0
    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);
    }
Exemple #3
0
 private void Awake()
 {
     if (SaveManager.SaveExist())
     {
         World_Data data = SaveManager.LoadWorld();
         Seed = data.Seed;
     }
     else
     {
         Seed = RandomSeed();
     }
     SetSeed();
 }