Example #1
0
    void Update()
    {
        //if (!IsPaused)
        //    Time.timeScale = timescale;

        TimeDelta += Time.deltaTime;

        //update label
        UpdateTimeLabel();

        if (TimeDelta >= DayTime)
        {
            //convert timedelta to day
            TimeDelta = 0;
            Days++;

            //convert days to week
            if (Days >= WeekTime)
            {
                Days = 0;
                Weeks++;
            }

            //convert weeks to month
            if (Weeks >= MonthTime)
            {
                Weeks = 0;
                Months++;
                //research.IterateResearch();
                //labor.PayWages();
            }

            //convert months to season
            if (Months >= SeasonTime)
            {
                Months = 0;
                Seasons++;
                UpdateClockColor();
                if (Seasons < YearTime)
                {
                    money.BeginNewQuarter(Seasons, CurrentYear);
                }
                finances.LoadFinancialReports();
                ProductivityController.UpdateProductivities();
            }

            //convert seasons to year
            if (Seasons >= YearTime)
            {
                Seasons = 0;
                Years++;
                money.BeginNewQuarter(Seasons, CurrentYear);
                finances.LoadFinancialReports();
                UpdateClockColor();
            }
        }
    }