updateTimers

View sourceupdateTimers(world: World): void

Advances every Timer component by the current virtual-clock delta.

TimePlugin registers this exact function directly in the repeating AppSchedule.Update schedule and the CoreSystems.Start group. This system reads the delta for the current frame from VirtualClock.

Each invocation creates a Query requiring Timer, reads VirtualClock#getDelta, and calls Timer#update on every currently matching live component with that delta in seconds. The timer updates elapsed, completion, cycle, and playback state; this system does not update the clock, create entities, or return a value. A world with no matching timers has no timer side effects, while a world without VirtualClock fails when its resource is requested.

Examples

import { Timer, TimePlugin } from '@wimaengine/time'

app.registerPlugin(new TimePlugin())
world.spawn([new Timer({ duration: 1 })])
// The timer advances automatically on each Update/Start pass.

Parameters

NameDescriptionDefault
world

Update world containing the VirtualClock and timer entities.

—

Throws

If the world does not contain a VirtualClock.