Пример #1
0
        SaveDataEmptyBottle CreateSaveDataEmptyBottle(GameObject go)
        {
            SaveDataEmptyBottle emptyBottle = new SaveDataEmptyBottle();

            emptyBottle.Name     = go.name;
            emptyBottle.Position = go.transform.position;
            emptyBottle.RotX     = go.transform.rotation.eulerAngles.x;
            emptyBottle.RotY     = go.transform.rotation.eulerAngles.y;
            emptyBottle.RotZ     = go.transform.rotation.eulerAngles.y;
            return(emptyBottle);
        }
Пример #2
0
        public override void OnSave()
        {
            // Called once, when save and quit
            // Serialize your save file here.
            SaveData sd = new SaveData();

            sd.unredeemedBottleDeposit = bottleRecyclingManager.totalMoneyAmountFromBottles;

            // Save Empty Bottles and Beercases, if set so.
            if ((bool)saveEmptyBottles.GetValue() || (bool)saveFilledBeercases.GetValue())
            {
                foreach (GameObject go in GameObject.FindGameObjectsWithTag("PART"))
                {
                    // empty bottles
                    if (go.name == "empty bottle(Clone)" && (bool)saveEmptyBottles.GetValue())
                    {
                        if (isBoozeBottle(go.transform)) // ignore booze bottles
                        {
                            continue;
                        }
                        SaveDataEmptyBottle emptyBottle = CreateSaveDataEmptyBottle(go);
                        sd.emptyBottles.Add(emptyBottle);
                        continue;
                    }

                    // filled beercases
                    if (go.name == "empty(itemx)" && (bool)saveFilledBeercases.GetValue())
                    {
                        BeercaseFilled filled = go.GetComponent <BeercaseFilled>();
                        if (filled)
                        {
                            SaveDataFilledBeercase filledBeercase = CreateSaveDataFilledBeercase(go);
                            sd.filledBeercases.Add(filledBeercase);
                            continue;
                        }
                    }
                }
            }

            // save to file
            SaveLoad.SerializeSaveFile(this, sd, "BottleRecyclingSave.save");
        }