Scheduler
Description:
A scheduler that manages the execution of scheduled tasks.
Class Object: Scheduler Class.
Inherits from: Object.
timeScale
Type: Field.
Description:
The time scale factor for the scheduler. This factor is applied to deltaTime that the scheduled functions will receive.
Signature:
timeScale: number
fixedFPS
Type: Field.
Description:
The target frame rate (in frames per second) for a fixed update mode. The fixed update will ensure a constant frame rate, and the operation handled in a fixed update can use a constant delta time value. It is used for preventing weird behavior of a physics engine or synchronizing some states via network communications.
Signature:
fixedFPS: integer
schedule
Type: Function.
Description:
Schedules a function to be called every frame.
Signature:
schedule: function(self: Scheduler, handler: function(number): boolean)
Parameters:
Parameter | Type | Description |
---|---|---|
handler | function | The function to be called. It should take a single argument of type number, which represents the delta time since the last frame. If the function returns true, it will not be called again. |
schedule
Type: Function.
Description:
Schedules a coroutine job to be resumed every frame.
Signature:
schedule: function(self: Scheduler, job: Routine.Job)
Parameters:
Parameter | Type | Description |
---|---|---|
job | Routine.Job | The coroutine job to be resumed. |
update
Type: Function.
Description:
Manually updates the scheduler if it is created by the user.
Signature:
update: function(self: Scheduler, deltaTime: number): boolean
Parameters:
Parameter | Type | Description |
---|---|---|
deltaTime | number | The time interval since the last update. |
Returns:
Return Type | Description |
---|---|
boolean | Returns true if the scheduler has stopped. |