예제 #1
0
    public void Save2()
    {
        BinaryFormatter binary = new BinaryFormatter();
        FileStream      file   = File.Create(Application.dataPath + "/Savegame2.dat");
        SaveManagment2  save2  = new SaveManagment2();

        save2.HScore     = GetComponent <SavedData>().HScore;
        save2.scoreValue = GetComponent <SavedData>().scoreValue;
        binary.Serialize(file, save2);
        file.Close();
    }
예제 #2
0
 public void Load2()
 {
     if (File.Exists(Application.dataPath + "/Savegame2.dat"))
     {
         BinaryFormatter binary = new BinaryFormatter();
         FileStream      file   = File.Open(Application.dataPath + "/Savegame2.dat", FileMode.Open);
         SaveManagment2  save2  = (SaveManagment2)binary.Deserialize(file);
         GetComponent <MenuGameEnd>().HighScore = save2.HScore;
         GetComponent <MenuGameEnd>().Score     = save2.scoreValue;
         file.Close();
     }
 }