Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    // 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;
        }
    }