private void TimerOnTimesUp() { TimesUp?.Invoke(); TimesUpAtTime?.Invoke(DateTime.Now); PlayerPrefsX.SetDateTime(name, DateTime.Now); PlayerPrefs.Save(); }
public void Start() { var lastActionTime = PlayerPrefsX.GetDateTime(name); var intervalCounter = new IntervalCounter( lastActionTime, DateTime.Now, interval ); PlayerPrefsX.SetDateTime(name, intervalCounter.LastIntervalTime); PlayerPrefs.Save(); foreach (var time in intervalCounter.AsTimeCollection()) { TimesUpAtTime?.Invoke(time); } Timer.MoveToTime(Convert.ToInt32(intervalCounter.TimeToNextInterval.TotalSeconds)); Timer.Start(); }