예제 #1
0
        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();
        }
예제 #2
0
    void DecreaseBar()
    {
        timeLeftSeconds -= refreshUpdateSeconds;

        if (timeLeftSeconds <= 0)
        {
            CancelInvoke(nameof(DecreaseBar));
            TimeExpired?.Invoke();
        }

        timeBar.fillAmount = timeLeftSeconds / totalTimeSeconds;
        timeBar.color      = gradient.Evaluate(timeBar.fillAmount);
    }
예제 #3
0
 public static void RaiseTimerExpired(TimerEventArgs e)
 {
     TimeExpired?.Invoke(null, e);
 }