public void Awake() { if (!Instance) { Instance = this; } else { Destroy(this); } }
void Awake() { I = this; DayEvents = new SortedList <int, System.Action>(); OnEveryDay = new System.Action(() => { var roundDay = ++CurDay % 30; CurDayText.text = roundDay.ToString(); if (roundDay == 0) { OnEveryMonth(); } if (DayEvents.Keys.Count != 0 && DayEvents.Keys[0] == CurDay) { DayEvents.Values[0](); DayEvents.RemoveAt(0); } }); OnEveryMonth = new System.Action(() => { var roundMonth = ++CurMonth % 12; CurMonthText.text = roundMonth.ToString(); if (roundMonth == 0) { OnEveryYear(); } }); OnEveryYear = new System.Action(() => { ++CurYear; CurYearText.text = CurYear.ToString(); }); }