Exemplo n.º 1
0
    //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");
    }
Exemplo n.º 2
0
 public GameData(SerializableConsumables pConsumables)
 {
     this.PlayerConsumables = pConsumables;
 }