//Gameplay save data public void SaveGame() { if (seconds > hiSecs) { hiSecs = seconds; } SerializableConsumables playerConsumables = new SerializableConsumables(coinBalance, hiMins, hiSecs, gunL, gunR, dailyTimer, adTimer, useAds, score, pistolUnlock, rifleUnlock, ARUnlock, currentAmmoBoxes, currentMech, playerStones); GameData gameData = new GameData(playerConsumables); BinaryFormatter bf = new BinaryFormatter(); File.Delete(Application.persistentDataPath + "/saveGame.txt"); FileStream file = File.Create(Application.persistentDataPath + "/saveGame.txt"); bf.Serialize(file, gameData); file.Close(); Debug.Log("Saved Successfully"); }
public GameData(SerializableConsumables pConsumables) { this.PlayerConsumables = pConsumables; }