Пример #1
0
        private void Save()
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/" + _fileName, FileMode.OpenOrCreate);
            VolumeData      data = new VolumeData(_ambianceVolume, _soundEffectVolume);

            bf.Serialize(file, data);
            file.Close();
        }
Пример #2
0
 private void Load()
 {
     if (File.Exists(Application.persistentDataPath + "/" + _fileName))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.persistentDataPath + "/" + _fileName, FileMode.Open);
         VolumeData      data = (VolumeData)bf.Deserialize(file);
         file.Close();
         _ambianceVolume    = data.ambiance;
         _soundEffectVolume = data.soundEffect;
     }
 }