Timer¶
Un temporizador de cuenta atrás.
Descripción¶
Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one-shot" mode.
Note: To create a one-shot timer without instantiating a node, use SceneTree.create_timer.
Tutoriales¶
Propiedades¶
|
||
|
||
|
||
|
Métodos¶
is_stopped ( ) const |
|
void |
|
void |
stop ( ) |
Señales¶
timeout ( )
Emitido cuando el temporizador llega a 0.
Enumeraciones¶
enum TimerProcessMode:
TIMER_PROCESS_PHYSICS = 0 --- Actualizar el temporizador durante el paso de la física en cada fotograma (procesamiento de cuadros fijos).
TIMER_PROCESS_IDLE = 1 --- Actualiza el temporizador durante el tiempo de inactividad en cada fotograma.
Descripciones de Propiedades¶
bool autostart
Default |
|
Setter |
set_autostart(value) |
Getter |
has_autostart() |
Si true
, el temporizador se iniciará automáticamente al entrar en el árbol de la escena.
Nota: Esta propiedad se ajusta automáticamente a false
después de que el temporizador entra en el árbol de la escena y comienza.
bool one_shot
Default |
|
Setter |
set_one_shot(value) |
Getter |
is_one_shot() |
Si true
, el temporizador se detendrá al llegar a 0. Si false
, se reiniciará.
bool paused
Setter |
set_paused(value) |
Getter |
is_paused() |
Si true
, el temporizador se pausa y no se procesará hasta que no se vuelva a pausar, incluso si se llama a start.
TimerProcessMode process_mode
Default |
|
Setter |
set_timer_process_mode(value) |
Getter |
get_timer_process_mode() |
Modo de procesamiento. Ver TimerProcessMode.
float time_left
Getter |
get_time_left() |
El tiempo restante del temporizador en segundos. Vuelve a 0 si el temporizador está inactivo.
Nota: No se puede ajustar este valor. Para cambiar el tiempo restante del temporizador, utilice start.
float wait_time
Default |
|
Setter |
set_wait_time(value) |
Getter |
get_wait_time() |
The wait time in seconds.
Note: Timers can only emit once per rendered frame at most (or once per physics frame if process_mode is TIMER_PROCESS_PHYSICS). This means very low wait times (lower than 0.05 seconds) will behave in significantly different ways depending on the rendered framerate. For very low wait times, it is recommended to use a process loop in a script instead of using a Timer node.
Descripciones de Métodos¶
bool is_stopped ( ) const
Devuelve true
si el temporizador se detiene.
void start ( float time_sec=-1 )
Starts the timer. Sets wait_time
to time_sec
if time_sec > 0
. This also resets the remaining time to wait_time
.
Note: This method will not resume a paused timer. See paused.
void stop ( )
Detiene el temporizador.