Clock Class |
Namespace: Gamelogic.Extensions
[VersionAttribute(1, 2, 0)] public class Clock
The Clock type exposes the following members.
Name | Description | |
---|---|---|
IsDone |
Gets a value indicating whether this instance is done.
| |
IsPaused |
Gets a value indicating whether this clock is paused.
| |
Time |
The current time on this clock in seconds as a float.
| |
TimeInSeconds |
Gets the time in seconds of this clock as an integer.
|
Name | Description | |
---|---|---|
AddTime |
Adds time to this clock. This will extend the time the clock expires by
the given amount.
| |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
Pause |
Pauses this clock.
| |
Reset |
Resets the clock to the specified stat time.
| |
ToString | (Inherited from Object.) | |
Unpause |
Unpauses this clock.
| |
Update |
Call this method repeatedly to update the time (typically, in a component's Update method).
|
Name | Description | |
---|---|---|
OnClockExpired |
Occurs when the clock expired.
| |
OnSecondsChanged |
Occurs when the seconds changed. Note that the seconds is the ceiling of the current time.
|
Name | Description | |
---|---|---|
ThrowIfNull |
Throws a NullReferenceException if the object is null.
(Defined by ObjectExtensions.) |
To use this clock, instantiate it, call Reset with the right time value, and call Update it each frame.
Any class that wants to be notified of events need to implement the IClockListener interface, and subscribe to events using the AddListener method. A listener can be removed with the RemoveListener event.
Clocks can be paused independently of Time.timeScale using the Pause method (and started again using Unpause).