Esempio n. 1
0
 public SaveData()
 {
     Score     = Game.Score.OnSave() as ScoreData;
     Player    = Game.Player.OnSave() as PlayerGameData;
     Asteroids = Game.Asteroids.OnSave() as AsteroidsData;
     Bullets   = Game.Bullets.OnSave() as BulletsData;
 }
Esempio n. 2
0
 private void SetEmptyAsteroidsData()
 {
     AsteroidsData = new AsteroidsData();
     AsteroidsData.AsteroidXDirection = new float[FieldSize, FieldSize];
     AsteroidsData.AsteroidYDirection = new float[FieldSize, FieldSize];
     AsteroidsData.AsteroidSpeed      = new float[FieldSize, FieldSize];
     SaveExists = false;
 }
Esempio n. 3
0
 private void TryLoadingAsteroidsDataFromFile()
 {
     if (File.Exists(Application.persistentDataPath + "/AsteroidsData.dat"))
     {
         if (new FileInfo(Application.persistentDataPath + "/AsteroidsData.dat").Length == 0)
         {
             BinaryFormatter binaryFormatter = new BinaryFormatter();
             FileStream      file            = File.Open(Application.persistentDataPath + "/AsteroidsData.dat", FileMode.Open);
             AsteroidsData = (AsteroidsData)binaryFormatter.Deserialize(file);
             file.Close();
             SaveExists = true;
         }
         else
         {
             SetEmptyAsteroidsData();
         }
     }
     else
     {
         SetEmptyAsteroidsData();
     }
 }