Ejemplo n.º 1
0
    public void LoadInfo(PlotSaveData info)
    {
        Occupied       = info.Occupied;
        QuantNutrients = info.QuantNutrients;
        WaterContent   = info.WaterContent;

        UpdateSliders();

        if (Occupied == true)
        {
            crop.Kill();
        }

        if (info.Occupied == true)
        {
            CropSaveData temp = JsonUtility.FromJson <CropSaveData>(info.crop);

            string cropMother = temp.plantType;

            //Find Crop Mother
            CropMother cropToPlant = motherManager.FindMotherOnName(cropMother);

            //Plant Crop
            cropToPlant.NewPlant(this);

            //Edit Crop info
            crop.LoadInfo(temp);
        }
    }
Ejemplo n.º 2
0
    public CollectionSaveData SaveInfo()
    {
        CollectionSaveData saveData = new CollectionSaveData();

        for (int i = 0; i < map.Length; i++)               //row
        {
            for (int j = 0; j < map[i].mapCol.Length; j++) //col
            {
                PlotSaveData temp = map[i].mapCol[j].SaveInfo();
                temp.ID[0] = i;
                temp.ID[1] = j;

                string plotStringData = JsonUtility.ToJson(temp);
                //Debug.Log(plotStringData);

                saveData.plotData.Add(plotStringData);
            }
        }

        saveData.UpgradesUnlocked = UpgradesUnlocked;

        saveData.Events    = new bool[3];
        saveData.Events[0] = EnergyUp.activeSelf;
        saveData.Events[1] = EnergyDown.activeSelf;
        saveData.Events[2] = Growth.activeSelf;

        return(saveData);
    }
Ejemplo n.º 3
0
    public PlotSaveData SaveInfo()
    {
        PlotSaveData saveData = new PlotSaveData();

        saveData.Occupied       = Occupied;
        saveData.QuantNutrients = QuantNutrients;
        saveData.WaterContent   = WaterContent;

        if (Occupied == true)
        {
            saveData.crop = crop.SaveInfo();
        }
        else
        {
            saveData.crop = "";
        }

        return(saveData);
    }
Ejemplo n.º 4
0
    public void LoadInfo(CollectionSaveData info)
    {
        UpgradesUnlocked = info.UpgradesUnlocked;
        upgrades.LoadGame(UpgradesUnlocked);

        bool EnergyUpActive   = info.Events[0];
        bool EnergyDownActive = info.Events[1];
        bool GrowthActive     = info.Events[2];

        for (int k = 0; k < info.plotData.Count; k++)
        {
            PlotSaveData temp = JsonUtility.FromJson <PlotSaveData>(info.plotData[k]);

            int i = temp.ID[0];
            int j = temp.ID[1];

            map[i].mapCol[j].LoadInfo(temp);
        }

        EnergyUp.SetActive(false);
        EnergyDown.SetActive(false);
        Growth.SetActive(false);

        if (EnergyUpActive == true)
        {
            EnergyUp.SetActive(true);
        }
        else if (EnergyDownActive)
        {
            EnergyDown.SetActive(true);
        }
        else if (GrowthActive)
        {
            Growth.SetActive(true);
        }
    }