Lysa.nodes  0.0
Lysa 3D Engine
Timer Class Referenceabstract

Detailed Description

A countdown timer node that fires a TIMEOUT event when it expires.

Inherits from: Node

Lua full name: lysa.nodes.Timer

Public Member Functions

Timer create (wait_time: number|nil, one_shot: boolean|nil)static
 Creates a Timer node with an optional duration and one-shot flag. More...
 
nil start (time_sec: number|nil)
 Starts or restarts the timer. If time_sec > 0 it overrides wait_time for this run. More...
 
nil stop ()
 Stops the timer without firing the TIMEOUT event. More...
 

Properties

boolean is_stopped
 True if the timer is not currently running. (read-only)
 
number time_left
 Remaining time in seconds; 0 if the timer is stopped. (read-only)
 
number wait_time
 Total countdown duration in seconds (default 1.0).
 
boolean one_shot
 If true the timer stops automatically after the first TIMEOUT; otherwise it loops.
 
boolean autostart
 If true the timer starts automatically when the node enters the scene tree.
 
boolean paused
 Pauses or resumes the countdown without resetting the remaining time.
 

Member Function Documentation

Timer create ( number|nil  wait_time,
boolean|nil  one_shot)
static

Creates a Timer node with an optional duration and one-shot flag.

Parameters
wait_timenumber|nil
one_shotboolean|nil
Returns
Timer
nil start ( number|nil  time_sec)

Starts or restarts the timer. If time_sec > 0 it overrides wait_time for this run.

Parameters
time_secnumber|nil
nil stop ( )

Stops the timer without firing the TIMEOUT event.

Property Documentation

boolean is_stopped

True if the timer is not currently running. (read-only)

number time_left

Remaining time in seconds; 0 if the timer is stopped. (read-only)

number wait_time

Total countdown duration in seconds (default 1.0).

boolean one_shot

If true the timer stops automatically after the first TIMEOUT; otherwise it loops.

boolean autostart

If true the timer starts automatically when the node enters the scene tree.

boolean paused

Pauses or resumes the countdown without resetting the remaining time.