コード例 #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);
    }
コード例 #2
0
ファイル: StatSlider.cs プロジェクト: StrangeTurtles/MyPetSim
    // 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;
        }
    }