Timers

Implemented

This feature is fully implemented.

Countdown and interval timers for cooldowns, spawning, and delays, implemented as a Timer component and TimerSystem.

Timer Component

world.AddComponent(entity, new Timer {
    Duration = 2.0f,    // seconds until timer fires
    Repeat = true,      // true = interval timer, false = one-shot
    Tag = "spawn"       // optional label for identification
});
FieldTypeDefaultDescription
Durationfloat1Time in seconds until the timer fires
Elapsedfloat0Current elapsed time (managed by TimerSystem)
RepeatboolfalseIf true, resets and fires again each interval
FinishedboolfalseSet to true when elapsed reaches duration
Tagstring""Optional label to identify timer purpose

TimerSystem

The TimerSystem ticks all Timer components each frame using world.DeltaTime:

  • One-shot timers (Repeat = false): Finished is set to true once and the timer stops
  • Interval timers (Repeat = true): Finished is set to true each cycle, and Elapsed wraps by subtracting Duration

Check timer.Finished in your own systems to react to timer events.