public void startingSave(bool saveToJson) { SaveData saveData = new SaveData(); saveData.savedHealth = pet.GetHealth(); saveData.savedHunger = pet.GetHunger(); saveData.savedHappiness = pet.GetHappiness(); json = JsonUtility.ToJson(saveData); File.WriteAllText(path, json); }
// Update is called once per frame void Update() { switch (stat) { case Stat.HEALTH: statSlider.value = pet.GetHealth(); break; case Stat.HUNGER: statSlider.value = pet.GetHunger(); break; case Stat.HAPPINESS: statSlider.value = pet.GetHappiness(); break; default: break; } }