You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful in some special cases to be able to restart a running timer from the beginning. Maybe this functionality already exists? Here is my attempt, but maybe I missed something:
/// <summary>
/// Restarts a running or paused timer.
/// </summary>
public void Restart()
{
if (this.isDone)
{
return;
}
this._timeElapsedBeforePause = null;
this._startTime = this.GetWorldTime();
this.isCompleted = false;
}
The text was updated successfully, but these errors were encountered:
Afaik after completion the timer cannot be reused.
Changing .isCompleted will not give you the result you seek as the timer already has been removed from the TimerManager List of Timers.
So if the timer is completed, I start a new one.
If it is still running you can reset the time.
/// <summary>
/// Restart a Timer by Setting the Starttime and LastUpdatetime to Timer.GetWorldTime(). Returns true if it had not Completed, false if the Timer is Completed.
/// </summary>
public bool Restart()
{
if (!this.isCompleted)
{
this._startTime = this.GetWorldTime();
this._lastUpdateTime = this._startTime;
return true;
}
return false;
}
It would be useful in some special cases to be able to restart a running timer from the beginning. Maybe this functionality already exists? Here is my attempt, but maybe I missed something:
The text was updated successfully, but these errors were encountered: