Ejemplo n.º 1
0
    void Save()
    {
        GameDataWriter dataWriter = new GameDataWriter(savePath);

        stateData = new GameStateData
        {
            petName = currentPet.petName,

            energyLevel    = currentPet.energy,
            happinessLevel = currentPet.happiness,

            isSleep = currentPet.isSleep,
            isSick  = currentPet.isSick,

            hasTakenBath       = currentPet.hasTakenBath,
            totalSleepDuration = currentPet.remainingSleepDuration,
            foodCount          = currentPet.foodCount,
            rubCount           = currentPet.rubCount,

            lastRecordedEnergyTimer    = currentPet.energyTimer,
            lastRecordedHappinessTimer = currentPet.happinessTimer,
            lastRecordedSleepStartTime = currentPet.sleepTimeLastTick,
            lastRecordedDate           = currentPet.date,

            isEatingTimerOn = currentPet.eatingTimerOn,
            isRubTimerOn    = currentPet.rubTimerOn,
            isPlayTimerOn   = currentPet.playTimerOn,

            eatCountdown  = currentPet.timeUntilNextMealAllowed,
            rubCountdown  = currentPet.timeUntilNextRubAllowed,
            playCountdown = currentPet.timeUntilCanPlayAgain,

            eatCountdownLastTick  = currentPet.mealTimerLastTick,
            rubCountdownLastTick  = currentPet.rubTimerLastTick,
            playCountdownLastTick = currentPet.playTimerLastTick
        };

        Debug.Log(stateData.isSleep);

        dataWriter.SaveData(stateData);


        Debug.Log("File saved.");
    }