Murl Engine Lua Addon API  Version 1.0 beta
Murl.Logic.ITimeframe

The ITimeframe interface.

The timeframe is evaluated each logic tick using the IStepable interface.
A timeframe is a lightweight object for measuring a time interval.


Table members

Methods


GetStepable()

Get the stepable interface shared pointer. The ITimeframe conforms to the IStepable interface.

Murl.SharedPointer.LogicIStepable GetStepable()

Returns
Murl.SharedPointer.LogicIStepable The stepable interface shared pointer.

Reset()

Reset the timeframe. Stop the timeframe, set the current time to zero and reset the WasRunning() state.

Reset()


Start()

Start the timeframe. The time starts with current time zero and is evaluated until the end time is reached.

Start()


Start(endTime)

Start the timeframe with a specified interval. The time starts with current time zero and is evaluated until the end time is reached.

Start(Number endTime)

Parameters
endTimeThe time interval in seconds.

SetCurrentTime(time)

Set the current time. Modify the current time if the timeframe is running and the new time is within the interval [0 .. end time].

Boolean SetCurrentTime(Number time)

Parameters
timeThe current time in seconds.
Returns
Boolean true if successful.

Finish()

Finish the timeframe. Set the current time to the end time and the WasRunning() state to true if the timeframe is running.

Boolean Finish()

Returns
Boolean true if successful.

IsRunning()

Check if the timeframe is running. A timeframe can be started by calling Start() and stopped by calling Finish() or Reset().

Boolean IsRunning()

Returns
Boolean true if running.

WasStarted()

Check if the timeframe was started from the beginning.

Boolean WasStarted()

Returns
Boolean true if started.

WasRunning()

Check if the timeframe has finished. If the timeframe is finished this state is true within the current logic tick only and will be cleared at the next logic tick.
(!) This state remains unchanged if the processor holding the timeframe's observer is set to inactive within the current logic tick. In such a case the Reset() method can be called to clear the state.

Boolean WasRunning()

Returns
Boolean true if finished.

IsOrWasRunning()

Check if the timeframe is or was running. Returns (IsRunning() || WasRunning()) state.

Boolean IsOrWasRunning()

Returns
Boolean true if IsRunning() or WasRunning() is true.

HasPassedTime(time)

Check if the current time has passed a specified time within the most recent tick.

Boolean HasPassedTime(Number time)

Parameters
timeThe time to check in seconds.
Returns
Boolean true if the current time has passed a specified time within the most recent tick.

SetTimeScale(timeScale)

Set the time scale factor. The recent tick duration is multiplied by the time scale factor and added to the current time each logic tick. The default time scale factor is 1.

Boolean SetTimeScale(Number timeScale)

Parameters
timeScaleThe time scale factor.
Returns
Boolean true if successful.

GetTimeScale()

Get the time scale factor.

Number GetTimeScale()

Returns
Number The time scale factor.

SetEndTime(endTime)

Set the end time.

Boolean SetEndTime(Number endTime)

Parameters
endTimeThe end time in seconds.
Returns
Boolean true if successful.

GetEndTime()

Get the end time.

Number GetEndTime()

Returns
Number The end time in seconds.

GetCurrentTime()

Get the current time.

Number GetCurrentTime()

Returns
Number The current time in seconds.

GetRemainingTime()

Get the remaining time. This method calculates GetEndTime() - GetCurrentTime().

Number GetRemainingTime()

Returns
Number The remaining time in seconds.