mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
124 lines
4.1 KiB
ReStructuredText
124 lines
4.1 KiB
ReStructuredText
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the Timer.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_Timer:
|
|
|
|
Timer
|
|
=====
|
|
|
|
**Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
|
|
|
|
**Category:** Core
|
|
|
|
Brief Description
|
|
-----------------
|
|
|
|
A countdown timer.
|
|
|
|
Member Functions
|
|
----------------
|
|
|
|
+----------------------------+--------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_time_left<class_Timer_get_time_left>` **(** **)** const |
|
|
+----------------------------+--------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_paused<class_Timer_is_paused>` **(** **)** const |
|
|
+----------------------------+--------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_stopped<class_Timer_is_stopped>` **(** **)** const |
|
|
+----------------------------+--------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_paused<class_Timer_set_paused>` **(** :ref:`bool<class_bool>` paused **)** |
|
|
+----------------------------+--------------------------------------------------------------------------------------+
|
|
| void | :ref:`start<class_Timer_start>` **(** **)** |
|
|
+----------------------------+--------------------------------------------------------------------------------------+
|
|
| void | :ref:`stop<class_Timer_stop>` **(** **)** |
|
|
+----------------------------+--------------------------------------------------------------------------------------+
|
|
|
|
Signals
|
|
-------
|
|
|
|
.. _class_Timer_timeout:
|
|
|
|
- **timeout** **(** **)**
|
|
|
|
Emitted when the Timer reaches 0.
|
|
|
|
|
|
Member Variables
|
|
----------------
|
|
|
|
.. _class_Timer_autostart:
|
|
|
|
- :ref:`bool<class_bool>` **autostart** - If ``true``, Timer will automatically start when entering the scene tree. Default value: ``false``.
|
|
|
|
.. _class_Timer_one_shot:
|
|
|
|
- :ref:`bool<class_bool>` **one_shot** - If ``true``, Timer will stop when reaching 0. If ``false``, it will restart. Default value: ``false``.
|
|
|
|
.. _class_Timer_process_mode:
|
|
|
|
- :ref:`TimerProcessMode<enum_timer_timerprocessmode>` **process_mode** - Processing mode. Uses TIMER_PROCESS\_\* constants as value.
|
|
|
|
.. _class_Timer_wait_time:
|
|
|
|
- :ref:`float<class_float>` **wait_time** - Wait time in seconds.
|
|
|
|
|
|
Enums
|
|
-----
|
|
|
|
.. _enum_Timer_TimerProcessMode:
|
|
|
|
enum **TimerProcessMode**
|
|
|
|
- **TIMER_PROCESS_PHYSICS** = **0** --- Update the Timer during the physics step at each frame (fixed framerate processing).
|
|
- **TIMER_PROCESS_IDLE** = **1** --- Update the Timer during the idle time at each frame.
|
|
|
|
|
|
Description
|
|
-----------
|
|
|
|
Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one shot" mode.
|
|
|
|
Member Function Description
|
|
---------------------------
|
|
|
|
.. _class_Timer_get_time_left:
|
|
|
|
- :ref:`float<class_float>` **get_time_left** **(** **)** const
|
|
|
|
Returns the timer's remaining time in seconds. Returns 0 if the timer is inactive.
|
|
|
|
.. _class_Timer_is_paused:
|
|
|
|
- :ref:`bool<class_bool>` **is_paused** **(** **)** const
|
|
|
|
Returns ``true`` if the timer is paused.
|
|
|
|
.. _class_Timer_is_stopped:
|
|
|
|
- :ref:`bool<class_bool>` **is_stopped** **(** **)** const
|
|
|
|
Returns ``true`` if the timer is stopped.
|
|
|
|
.. _class_Timer_set_paused:
|
|
|
|
- void **set_paused** **(** :ref:`bool<class_bool>` paused **)**
|
|
|
|
Pauses the timer. If ``paused`` is ``true``, the timer will not process until it is started or unpaused again, even if :ref:`start<class_Timer_start>` is called.
|
|
|
|
.. _class_Timer_start:
|
|
|
|
- void **start** **(** **)**
|
|
|
|
Starts the timer. This also resets the remaining time to ``wait_time``.
|
|
|
|
Note: this method will not resume a paused timer. See :ref:`set_paused<class_Timer_set_paused>`.
|
|
|
|
.. _class_Timer_stop:
|
|
|
|
- void **stop** **(** **)**
|
|
|
|
Stop (cancel) the Timer.
|
|
|
|
|