コード例 #1
0
        /// <summary>
        /// Add time to the countdown and notify listeners that the interval has changed
        /// </summary>
        /// <param name="ValueToAdd">The amount of time to be added to the current value</param>
        public void AddTime(float ValueToAdd)
        {
            currentInterval += ValueToAdd;

            if (IsTimerRunning)
            {
                OnIntervalElapsed.SafeInvoke(currentInterval);
            }
        }
コード例 #2
0
        /// <summary>
        /// Resets the stopwatch value
        /// </summary>
        /// <param name="StartIfNotRunning">True to start the stopwatch if it isn't currently running</param>
        public virtual void ResetStopwatch(bool StartIfNotRunning = true)
        {
            secondsPassed = 0f;

            if (!IsStopwatchRunning && StartIfNotRunning)
            {
                StartStopwatch();
            }
            else
            {
                OnStopwatchRestarted.SafeInvoke();
            }

            OnIntervalElapsed.SafeInvoke(secondsPassed);
        }