void Increment() { int amount; if (timerMode == TimerMode.Countdown) { amount = NEG_INCREMENT; } else { amount = POS_INCREMENT; } if (CheckSeconds()) { ResetSeconds(); minutes += amount; } if (CheckMinutes()) { ResetMinutes(); hours += amount; } if (CheckHours()) { ResetHours(); tmrUpdateTimer.Stop(); } seconds += amount; if (CheckTimeLeft()) { TimeExpired?.Invoke(this, new EventArgs()); } UpdateLabel(); }
void DecreaseBar() { timeLeftSeconds -= refreshUpdateSeconds; if (timeLeftSeconds <= 0) { CancelInvoke(nameof(DecreaseBar)); TimeExpired?.Invoke(); } timeBar.fillAmount = timeLeftSeconds / totalTimeSeconds; timeBar.color = gradient.Evaluate(timeBar.fillAmount); }
public static void RaiseTimerExpired(TimerEventArgs e) { TimeExpired?.Invoke(null, e); }