//THINGS TO SAVE //inventory //dialogue public static void SaveGlobalProgress(GlobalProgressChecker gpc) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/globalprog.bug"; FileStream stream = new FileStream(path, FileMode.Create); GlobalProgData data = new GlobalProgData(gpc); formatter.Serialize(stream, data); stream.Close(); }
public void LoadGame() { //GLOBAL GlobalProgData data = SaveSystem.LoadGlobalProgress(); SceneTransition.instance.CallTransitionCoroutineRandomMask(data.currentScene); NumberOfBugsLeft.instance.numberOfBugsLeft = data.bugsRemaining; //BROKEN. i think there's a weird total - remaining thing i need to do for (int i = 0; i < data.garden1Progress.Length; i++) { GlobalProgressChecker.instance.garden1ProgressCheck[i] = data.garden1Progress[i]; } for (int i = 0; i < data.garden2Progress.Length; i++) { GlobalProgressChecker.instance.garden2ProgressCheck[i] = data.garden2Progress[i]; } //DIALOGUE VD.LoadState("Garden", true); }
public static GlobalProgData LoadGlobalProgress() { string path = Application.persistentDataPath + "/globalprog.bug"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); GlobalProgData data = formatter.Deserialize(stream) as GlobalProgData; stream.Close(); return(data); } else { Debug.LogError("Save file not found in " + path); return(null); } }