コード例 #1
0
    /// <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;
        }
    }
コード例 #2
0
ファイル: ClockParts.cs プロジェクト: CserTamasJanos/Clock
        /// <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);
            }
        }
コード例 #3
0
ファイル: UITimer.cs プロジェクト: firakti/PomodoroTimer
 private void OnTick()
 {
     if (IsRunning)
     {
         TimerTickEvent?.Invoke(this, new UITimerTickEventArgs {
             RemainningTime = remainningTime
         });
     }
 }
コード例 #4
0
ファイル: GameProxy.cs プロジェクト: votizlov/Unity_1
 public void OnTimerTick(float f)
 {
     TimerTickEvent?.Invoke(f);
 }