TimerTick Class
Namespace: Stride.Games.TimeAssembly: Stride.Games.dll
This provides timing information similar to System.Diagnostics.Stopwatch but an update occurring only on a Tick() method.
public class TimerTick
Name | Description | |
---|---|---|
Constructors | ||
TimerTick() | Initializes a new instance of the TimerTick class. |
|
TimerTick(TimeSpan) | Initializes a new instance of the TimerTick class. |
|
Properties | ||
ElapsedTime | Gets the elapsed time since the previous call to Tick(). |
|
ElapsedTimeWithPause | Gets the elapsed time since the previous call to Tick() including Pause() |
|
IsPaused | Gets a value indicating whether this instance is paused. |
|
SpeedFactor | Gets or sets the speed factor. Default is 1.0 |
|
StartTime | Gets the start time when this timer was created. |
|
TotalTime | Gets the total time elasped since the last reset or when this timer was created. |
|
TotalTimeWithPause | Gets the total time elasped since the last reset or when this timer was created, including Pause() |
|
Methods | ||
Pause() | Pauses this instance. |
|
Reset() | Resets this instance. TotalTime is set to zero. |
|
Reset(TimeSpan) | Resets this instance. TotalTime is set to startTime. |
|
Resume() | Resumes this instance, only if a call to Pause() has been already issued. |
|
Tick() | Update the TotalTime and ElapsedTime, |
Constructors
TimerTick()
Initializes a new instance of the TimerTick class.
public TimerTick()
TimerTick(TimeSpan)
Initializes a new instance of the TimerTick class.
public TimerTick(TimeSpan startTime)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | startTime | The start time. |
Properties
ElapsedTime
Gets the elapsed time since the previous call to Tick().
public TimeSpan ElapsedTime { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
ElapsedTimeWithPause
public TimeSpan ElapsedTimeWithPause { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
IsPaused
Gets a value indicating whether this instance is paused.
public bool IsPaused { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
SpeedFactor
Gets or sets the speed factor. Default is 1.0
public double SpeedFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The speed factor. |
StartTime
Gets the start time when this timer was created.
public TimeSpan StartTime { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
TotalTime
Gets the total time elasped since the last reset or when this timer was created.
public TimeSpan TotalTime { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
TotalTimeWithPause
Gets the total time elasped since the last reset or when this timer was created, including Pause()
public TimeSpan TotalTimeWithPause { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Methods
Pause()
Pauses this instance.
public void Pause()
Reset()
Resets this instance. TotalTime is set to zero.
public void Reset()
Reset(TimeSpan)
Resets this instance. TotalTime is set to startTime.
public void Reset(TimeSpan startTime)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | startTime | The start time. |
Resume()
Resumes this instance, only if a call to Pause() has been already issued.
public void Resume()
Tick()
Update the TotalTime and ElapsedTime,
public void Tick()
Remarks
This method must be called on a regular basis at every tick.