float totalSeconds; // The total seconds the timer will run #endregion Fields #region Constructors /// <summary> /// Constructor /// </summary> /// <param name="seconds">the seconds for the timer</param> public Timer(float seconds) { // Sets the time and creates the finish event totalSeconds = seconds; elapsedSeconds = seconds; timerFinishedEvent = new TimerFinishedEvent(); }
private void OnFinished() { PomodoroState complatedState = PomodoroStatus.PomodoroState; TimerFinishedEvent?.Invoke(this, new PomodoroChangedEventArgs(complatedState)); if (complatedState == PomodoroState.Pomodoro) { FinishedWitoutSessionBreak++; if (FinishedWitoutSessionBreak == PomodoroSettings.SessionPomodoroCount) { StartSessionBreak(); } else { StartBreak(); } } else if (complatedState == PomodoroState.PomodoroBreak || complatedState == PomodoroState.SessionBreak) { if (PomodoroSettings.AutoContinue) { StartPomodoro(); } } else { WaitForStart(); } }
public static void UpdateTimer(Timer timer, TimerFinishedEvent timerEvents) { var previousTime = timer.time; timer.time += Time.deltaTime; if (previousTime < timer.duration && timer.time >= timer.duration) { timerEvents.Invoke(timer); } }
private void OnTimerFinished(object sender, PomodoroChangedEventArgs eventArgs) { TimerFinishedEvent?.Invoke( this, eventArgs ); if (IsNotificationEnable) { NotificationService.SetFinisedInfo(eventArgs.ComplatedState); } if (eventArgs.ComplatedState == PomodoroState.Pomodoro) { OnPomodoroFinished(); } else { OnBreakFinished(); } }
private void OnFinished() { Logger.Log("Finished\n\n"); PomodoroState complatedState = PomodoroStatus.PomodoroState; TimerFinishedEvent?.Invoke(this, new PomodoroChangedEventArgs(complatedState)); switch (complatedState) { case PomodoroState.Pomodoro: FinishedWitoutSessionBreak++; if (FinishedWitoutSessionBreak == PomodoroSettings.SessionPomodoroCount) { StartSessionBreak(); } else { StartBreak(); } break; case PomodoroState.PomodoroBreak: case PomodoroState.SessionBreak: if (PomodoroSettings.AutoContinue) { StartPomodoro(); } else { WaitForStart(); } break; default: WaitForStart(); break; } }
private void TimerFinished() { timerActive = false; TimerFinishedEvent?.Invoke(); }
void Awake() { timerFinishedEvent = new TimerFinishedEvent(); timerStartEvent = new TimerStartEvent(); }