static void HourHandler() { if (delta_hour != DateTime.Now.Hour) { OnHour.Invoke(DateTime.Now.Hour); } delta_hour = DateTime.Now.Hour; }
void HourPass() { Hour += 1; HourEvent.Invoke(); for (int i = 0; i < CurrentDeps.Count; i++) { CurrentDeps[i].Produce(); } if (Hour > 8) { //for(int i = 0; i < CurrentDeps.Count; i++) //{ // CurrentDeps[i].OneHourPass(); //} Hour = 8; FOEMoney += 30; if (FOEMoney >= FOEMoneyRequest) { FOEEvent(); } StartWorkEnd(); } //if (Day > 5) //旧的5日1周时间流 //{ // Week += 1; // Day = 1; // WeeklyEvent.Invoke(); //} //if(Week > 4) //{ // Month += 1; // Week = 1; // PrC.UserChange(); // Money = Money + Income - Salary; // MonthlyEvent.Invoke(); // for (int i = 0; i < CurrentDeps.Count; i++) // { // CurrentDeps[i].FailCheck(); // } //} //if(Month > 12) //{ // Year += 1; // Month = 1; //} //Text_Time.text = "年" + Year + " 月" + Month + " 周" + Week + " 日" + Day + " 时" + Hour; Text_Time.text = "年" + Year + " 月" + Month + " 周" + Week + " 时" + Hour; }
// Update is called once per frame void Update() { //Increase the time based on the time speed time += Time.deltaTime / timePerHour; //Check if we reached a new hour int hour = Mathf.FloorToInt(time); if (hour > currentHour) { currentHour = hour; hourChanged.Invoke(hour % 24); } //Display the rotation of the clock arms armMinutes.localEulerAngles = Vector3.forward * -360 * (time % 1); armHours.localEulerAngles = Vector3.forward * -360 * (Mathf.Floor(time) / 12 % 1); }
public void OnHourPassed() { HourEvent?.Invoke(this, new TimerEventArgs(this)); }