public PlayerData(VariablesToText player) { money = VariablesToText.money; stone = VariablesToText.stone; copper = VariablesToText.copper; tin = VariablesToText.tin; iron = VariablesToText.iron; silver = VariablesToText.silver; gold = VariablesToText.gold; quartz = VariablesToText.quartz; marble = VariablesToText.marble; sapphire = VariablesToText.sapphire; emerald = VariablesToText.emerald; ruby = VariablesToText.ruby; diamond = VariablesToText.diamond; totalStoneMiners = Shop.totalStoneMiners; totalCopperMiners = Shop.totalCopperMiners; totalTinMiners = Shop.totalTinMiners; totalIronMiners = Shop.totalIronMiners; totalSilverMiners = Shop.totalSilverMiners; totalGoldMiners = Shop.totalGoldMiners; TotalEnhancedClick = Shop.TotalEnhancedClick; StoneMinerCost = Shop.StoneMinerCost; CopperMinerCost = Shop.CopperMinerCost; TinMinerCost = Shop.TinMinerCost; IronMinerCost = Shop.IronMinerCost; SilverMinerCost = Shop.SilverMinerCost; GoldMinerCost = Shop.GoldMinerCost; EnhancedClickCost = Shop.EnhancedClickCost; }
public static void SaveGame(VariablesToText player) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/player.mg"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(player); formatter.Serialize(stream, data); stream.Close(); }