예제 #1
0
    void Update()
    {
        timeOfDay += Time.deltaTime;

        if (timeOfDay > dayLength)
        {
            day++;

            float temperatureChange = (weeklyTemperatureFlow.Evaluate(day % 5) + Random.Range(minRandomTemp, maxRandomTemp)) * (1f + tempDayFactor * day);
            outsideThermometer.IncreaseTemperature(temperatureChange);
            if (day % 5 == 0)
            {
                rain.gameObject.SetActive(true);
                RainAudio.SetActive(true);
            }
            else
            {
                rain.gameObject.SetActive(false);
                RainAudio.SetActive(false);
            }

            dailyOutsideTemperature.Add(outsideThermometer.temperature + temperatureChange);
            dailyTotalCash.Add(truck.lifetimeCash);

            timeOfDay -= dayLength;
        }

        truck.HeatTransfer(outsideThermometer.temperature);

        insideThermometer.fillAmount = (truck.temperature - truck.minTemperature) / (truck.maxTemperature - truck.minTemperature);
        thermometerGlow.SetFloat("RedBarFill", insideThermometer.fillAmount);

        sun.setProgress(timeOfDay / dayLength);

        UpdateText();
    }