/// <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; } }
/// <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); } }
private void OnTick() { if (IsRunning) { TimerTickEvent?.Invoke(this, new UITimerTickEventArgs { RemainningTime = remainningTime }); } }
public void OnTimerTick(float f) { TimerTickEvent?.Invoke(f); }