public static void LoadData() { if (File.Exists(Application.persistentDataPath + "Mobwaves.ds")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "Mobwaves.ds", FileMode.Open); mobWaves = (MobWaves)bf.Deserialize(file); file.Close(); } if (File.Exists(Application.persistentDataPath + "EnemyStats.ds")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "EnemyStats.ds", FileMode.Open); enemyStats = (EnemyStats)bf.Deserialize(file); file.Close(); } }
public static void NewGame() { mobWaves = new MobWaves(); enemyStats = new EnemyStats(); }