Click or drag to resize

Clock Class

Represents a clock that expires after a given time.
Inheritance Hierarchy
SystemObject
  Gamelogic.ExtensionsClock

Namespace:  Gamelogic.Extensions
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
[VersionAttribute(1, 2, 0)]
public class Clock

The Clock type exposes the following members.

Constructors
  NameDescription
Public methodClock
Initializes a new instance of the Clock class.
Top
Properties
  NameDescription
Public propertyIsDone
Gets a value indicating whether this instance is done.
Public propertyIsPaused
Gets a value indicating whether this clock is paused.
Public propertyTime
The current time on this clock in seconds as a float.
Public propertyTimeInSeconds
Gets the time in seconds of this clock as an integer.
Top
Methods
  NameDescription
Public methodAddTime
Adds time to this clock. This will extend the time the clock expires by the given amount.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodPause
Pauses this clock.
Public methodReset
Resets the clock to the specified stat time.
Public methodToString (Inherited from Object.)
Public methodUnpause
Unpauses this clock.
Public methodUpdate
Call this method repeatedly to update the time (typically, in a component's Update method).
Top
Events
  NameDescription
Public eventOnClockExpired
Occurs when the clock expired.
Public eventOnSecondsChanged
Occurs when the seconds changed. Note that the seconds is the ceiling of the current time.
Top
Extension Methods
  NameDescription
Public Extension MethodThrowIfNull
Throws a NullReferenceException if the object is null.
(Defined by ObjectExtensions.)
Top
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).

See Also