Struct Alarm
- Namespace
- Luny
- Assembly
- Luny.dll
A lightweight readonly struct representing a fixed point in the future. Used for high-performance polling in update loops.
public readonly struct Alarm
Constructors
Alarm(double)
Creates an alarm set to fire after the specified time or ticks.
public Alarm(double target)
Parameters
targetdouble
Fields
Target
public readonly double Target
Field Value
- double
Methods
At(double)
Creates an alarm at a specific absolute time.
public static Alarm At(double absoluteTime)
Parameters
absoluteTimedouble
Returns
At(long)
Creates an alarm at a specific total number of ticks.
public static Alarm At(long totalTicks)
Parameters
totalTickslong
Returns
CompareTo(Alarm)
public int CompareTo(Alarm other)
Parameters
otherAlarm
Returns
- int
CompareTo(double)
public int CompareTo(double other)
Parameters
otherdouble
Returns
- int
Equals(Alarm)
public bool Equals(Alarm other)
Parameters
otherAlarm
Returns
- bool
Equals(double)
public bool Equals(double other)
Parameters
otherdouble
Returns
- bool
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
- bool
From(double)
Returns a new alarm relative to the provided time.
Example: Alarm.In(5).From(Time.ElapsedSeconds)
public Alarm From(double now)
Parameters
nowdouble
Returns
From(long)
Returns a new alarm relative to the provided tick.
Example: Alarm.In(5).From(Time.FrameCount)
public Alarm From(long currentTick)
Parameters
currentTicklong
Returns
GetHashCode()
public override int GetHashCode()
Returns
- int
In(double)
Creates an alarm set to fire after the specified seconds. Note: Use From(now) to make it relative to a specific time.
public static Alarm In(double seconds)
Parameters
secondsdouble
Returns
In(long)
Creates an alarm set to fire after the specified number of ticks. Note: Use From(now) to make it relative to a specific tick count.
public static Alarm In(long ticks)
Parameters
tickslong
Returns
InHours(double)
Creates an alarm set to fire after the specified hours.
public static Alarm InHours(double h)
Parameters
hdouble
Returns
InMilliseconds(double)
Creates an alarm set to fire after the specified milliseconds.
public static Alarm InMilliseconds(double ms)
Parameters
msdouble
Returns
InMinutes(double)
Creates an alarm set to fire after the specified minutes.
public static Alarm InMinutes(double m)
Parameters
mdouble
Returns
IsElapsed(double)
Returns true if the target time has been reached or passed.
public bool IsElapsed(double now)
Parameters
nowdouble
Returns
- bool
RemainingMilliseconds(double)
Returns the remaining time in milliseconds.
public double RemainingMilliseconds(double now)
Parameters
nowdouble
Returns
- double
RemainingMinutes(double)
Returns the remaining time in minutes.
public double RemainingMinutes(double now)
Parameters
nowdouble
Returns
- double
RemainingSeconds(double)
Returns the remaining time in seconds.
public double RemainingSeconds(double now)
Parameters
nowdouble
Returns
- double
ToString()
public override string ToString()
Returns
- string
Operators
operator ==(Alarm, Alarm)
public static bool operator ==(Alarm left, Alarm right)
Parameters
Returns
- bool
operator ==(Alarm, double)
public static bool operator ==(Alarm left, double right)
Parameters
leftAlarmrightdouble
Returns
- bool
operator ==(double, Alarm)
public static bool operator ==(double left, Alarm right)
Parameters
leftdoublerightAlarm
Returns
- bool
operator >(Alarm, Alarm)
public static bool operator >(Alarm left, Alarm right)
Parameters
Returns
- bool
operator >(Alarm, double)
public static bool operator >(Alarm left, double right)
Parameters
leftAlarmrightdouble
Returns
- bool
operator >(double, Alarm)
public static bool operator >(double left, Alarm right)
Parameters
leftdoublerightAlarm
Returns
- bool
operator >=(Alarm, Alarm)
public static bool operator >=(Alarm left, Alarm right)
Parameters
Returns
- bool
operator >=(Alarm, double)
public static bool operator >=(Alarm left, double right)
Parameters
leftAlarmrightdouble
Returns
- bool
operator >=(double, Alarm)
public static bool operator >=(double left, Alarm right)
Parameters
leftdoublerightAlarm
Returns
- bool
operator !=(Alarm, Alarm)
public static bool operator !=(Alarm left, Alarm right)
Parameters
Returns
- bool
operator !=(Alarm, double)
public static bool operator !=(Alarm left, double right)
Parameters
leftAlarmrightdouble
Returns
- bool
operator !=(double, Alarm)
public static bool operator !=(double left, Alarm right)
Parameters
leftdoublerightAlarm
Returns
- bool
operator <(Alarm, Alarm)
public static bool operator <(Alarm left, Alarm right)
Parameters
Returns
- bool
operator <(Alarm, double)
public static bool operator <(Alarm left, double right)
Parameters
leftAlarmrightdouble
Returns
- bool
operator <(double, Alarm)
public static bool operator <(double left, Alarm right)
Parameters
leftdoublerightAlarm
Returns
- bool
operator <=(Alarm, Alarm)
public static bool operator <=(Alarm left, Alarm right)
Parameters
Returns
- bool
operator <=(Alarm, double)
public static bool operator <=(Alarm left, double right)
Parameters
leftAlarmrightdouble
Returns
- bool
operator <=(double, Alarm)
public static bool operator <=(double left, Alarm right)
Parameters
leftdoublerightAlarm
Returns
- bool