Class Clock
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
Represents a clock that expires after a given time.
[Version(1, 2, 0)]
public class Clock
- Inheritance
-
Clock
- Inherited Members
- Extension Methods
Remarks
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).
Constructors
Properties
- 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.
Methods
- AddTime(float)
Adds time to this clock. This will extend the time the clock expires by the given amount.
- Pause()
Pauses this clock.
- Reset(float)
Resets the clock to the specified stat time.
- Unpause()
Unpauses this clock.
- Update(float)
Call this method repeatedly to update the time (typically, in a component's Update method).
Events
- OnClockExpired
Occurs when the clock expired.
- OnSecondsChanged
Occurs when the seconds changed. Note that the seconds is the ceiling of the current time.