Exemplo n.º 1
0
    //transforms all the current scene data into a saveable format
    SaveData GetSaveData()
    {
        SaveData newSave = new SaveData();

        newSave.scoreData     = currentScoreData;
        newSave.currentCheese = gameData.total_cheese;

        foreach (Transform child in purchasedUpgrades)
        {
            newSave.upgradesPurchased.Add(child.GetComponent <Upgrade>().upgradeName);
        }


        foreach (Transform child in buildings)
        {
            RatBuildings ratBuilding = child.GetComponent <RatBuildings>();
            if (ratBuilding != null)
            {
                newSave.AddBuildingData(ratBuilding.GetBuildingData());
            }
        }
        return(newSave);
    }