Module Timer
Component to handle GUI timers.
Timer updating by game delta time. If game is not focused - timer will be not updated.
Functions
init(self, node, seconds_from, seconds_to, callback) | The Timer constructor |
set_interval(self, from, to) | Set time interval |
set_state(self, is_on) | Called when update |
set_to(self, set_to) | Set text to text field |
Fields
from | Initial timer value |
node | Trigger node |
on_set_enabled | On timer change enabled state callback(self, is_enabled) |
on_tick | On timer tick. |
on_timer_end | On timer end callback |
target | Target timer value |
value | Current timer value |
Functions
- init(self, node, seconds_from, seconds_to, callback)
-
The Timer constructor
Parameters:
- set_interval(self, from, to)
-
Set time interval
Parameters:
- self Timer Timer
- from number Start time in seconds
- to number Target time in seconds
- set_state(self, is_on)
-
Called when update
Parameters:
- self Timer Timer
- is_on boolean or nil Timer enable state
- set_to(self, set_to)
-
Set text to text field
Parameters:
- self Timer Timer
- set_to number Value in seconds
Fields
- from
-
Initial timer value
- from number
- node
-
Trigger node
- node node
- on_set_enabled
-
On timer change enabled state callback(self, is_enabled)
- on_set_enabled DruidEvent DruidEvent
- on_tick
-
On timer tick. Fire every second callback(self, value)
- on_tick DruidEvent DruidEvent
- on_timer_end
-
On timer end callback
- on_timer_end DruidEvent (self, Timer) DruidEvent
- target
-
Target timer value
- target number
- value
-
Current timer value
- value number