Esempio n. 1
0
 public static void LoadEnergies()
 {
     if (File.Exists(Application.persistentDataPath + "/private.gd"))
     {
         BinaryFormatter   bf       = new BinaryFormatter();
         FileStream        fs       = File.Open(Application.persistentDataPath + "/private.gd", FileMode.Open);
         ClassSaveEnergies energies = (ClassSaveEnergies)bf.Deserialize(fs);
         CalculationMinutes(energies.time, energies.energies);
         fs.Close();
     }
     else
     {
         SaveEnergies();
         LoadEnergies();
     }
 }
Esempio n. 2
0
    public static void SaveEnergies()
    {
        ClassSaveEnergies energies = new ClassSaveEnergies(EnergyBar.Energies);

        //Debug.Log("SAVE   " + Application.persistentDataPath + "/private.gd");
        if (savePoints.points1 == 11)
        {
            energies.energies = 5;
            //Debug.Log("Save.Points - " + save.points+"   energies - "+EnergyBar.Energies);
        }
        BinaryFormatter bf = new BinaryFormatter();
        FileStream      fs = File.Create(Application.persistentDataPath + "/private.gd");

        bf.Serialize(fs, energies);
        fs.Close();
    }