예제 #1
0
    void Update()
    {
        if (actualPetInfo.hpLvl >= 0)
        {
            dayTimePassed += Time.deltaTime;

            waterTimePassed += Time.deltaTime;
            foodTimePassed  += Time.deltaTime;
            gamesTimePassed += Time.deltaTime;
            sleepTimePassed += Time.deltaTime;

            if (waterTimePassed >= actualPetInfo.waterTimeLoss * 60 && actualPetInfo.waterLvl >= 0)
            {
                actualPetInfo.waterLvl--;
                waterTimePassed = 0;
                actualPetInfo.UpdateVisuals(actualPetInfo.waterLvl, actualPetInfo.pointsLists.waterPoints);
                actualPetInfo.ChangeMaterial(0);
                ShakeCam();
                StartCoroutine(resetMat());
            }
            if (foodTimePassed >= actualPetInfo.foodTimeLoss * 60 && actualPetInfo.foodLvl >= 0)
            {
                actualPetInfo.foodLvl--;
                foodTimePassed = 0;
                actualPetInfo.UpdateVisuals(actualPetInfo.foodLvl, actualPetInfo.pointsLists.foodPoints);
                actualPetInfo.ChangeMaterial(1);
                ShakeCam();
                StartCoroutine(resetMat());
            }
            if (gamesTimePassed >= actualPetInfo.gamesTimeLoss * 60 && actualPetInfo.happynessLvl >= 0)
            {
                actualPetInfo.happynessLvl--;
                gamesTimePassed = 0;
                actualPetInfo.UpdateVisuals(actualPetInfo.happynessLvl, actualPetInfo.pointsLists.gamesPoints);
                actualPetInfo.ChangeMaterial(2);
                ShakeCam();
                StartCoroutine(resetMat());
            }
            if (sleepTimePassed >= actualPetInfo.sleepTimeLoss * 60 && actualPetInfo.energyLvl >= 0)
            {
                actualPetInfo.energyLvl--;
                sleepTimePassed = 0;
                actualPetInfo.UpdateVisuals(actualPetInfo.energyLvl, actualPetInfo.pointsLists.sleepPoints);
                actualPetInfo.ChangeMaterial(3);
                ShakeCam();
                StartCoroutine(resetMat());
            }

            if (dayTimePassed >= actualPetInfo.dayTimeMin * 60)
            {
                dayCount++;
                dayTimePassed = 0;
                roomLogic.UpdateDayCount(dayCount);
                shopLogic.IncreaseEconomy(dayCount * 100);
                shopLogic.totalDays++;
            }
            CheckHp();
        }
    }