/// <summary> /// Starting new day, also, start all works in all productions /// Update is called once per frame /// </summary> void Update() { try { if (!m_isItPaused && !m_sIsItPaused && MainScript.m_isItInitialized) { Localization loc = Localization.GetLocalization(); Text txt = m_timeText; string timetxt = loc.m_ui.m_timeText; if (m_year > 0) { timetxt += " " + loc.m_ui.m_yearText + m_year.ToString(); } timetxt += " " + loc.m_ui.m_dayText + m_day.ToString(); if (m_isItPaused) { timetxt += " " + loc.m_ui.m_pausedText; } else { timetxt += " " + loc.m_ui.m_speedText + m_speed.ToString() + "x"; } txt.text = timetxt; if ((Time.time - _thisDayTime) * m_speed >= 1.0f) { int days = (int)((Time.time - _thisDayTime) * m_speed); while (days > 0) { m_day++; if (m_day > _yearLenght) { m_day -= _yearLenght; m_year++; } AbstractObject.DoWork(); days--; } _thisDayTime = Time.time; } } } catch (Exception ex) { Debug.LogError("TimeScript Update exception" + ex.Message); } }