/// <summary>
    /// Update is called once per frame
    /// </summary>
    void Update()
    {
        // Update timer and check for finished
        if (running)
        {
            elapsedSeconds += Time.deltaTime;

            if (isUsingTick) // unused in RoGC
            {
                // check for new countdown value
                int newCountdownValue = GetCurrentCountdownValue();
                if (newCountdownValue != previousCountdownValue)
                {
                    previousCountdownValue = newCountdownValue;
                    tickEvent.Invoke(previousCountdownValue);
                }
            }

            // check for timer finished
            if (elapsedSeconds >= totalSeconds)
            {
                running = false;
                finishEvent.Invoke();
            }
        }

        // if this was a retry attempt, disable a retry on the next frame.
        if (retry)
        {
            finishEvent.Invoke(); retry = false;
        }
    }
Example #2
0
        /// <summary>
        /// I use delegate to reach the picturebox of the form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ActualClockBitmap(object sender, EventArgs e)
        {
            ActualClockSight();

            if (TimerTickEvent != null)
            {
                TimerTickEvent.Invoke(ClockBitmap);
            }
        }
Example #3
0
 private void OnTick()
 {
     if (IsRunning)
     {
         TimerTickEvent?.Invoke(this, new UITimerTickEventArgs {
             RemainningTime = remainningTime
         });
     }
 }
Example #4
0
 public void OnTimerTick(float f)
 {
     TimerTickEvent?.Invoke(f);
 }