pandemonium_engine_docs/classes/class_scenetreetimer.rst

67 lines
2.2 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/SceneTreeTimer.xml.
.. _class_SceneTreeTimer:
SceneTreeTimer
==============
**Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
One-shot timer.
Description
-----------
A one-shot timer managed by the scene tree, which emits :ref:`timeout<class_SceneTreeTimer_signal_timeout>` on completion. See also :ref:`SceneTree.create_timer<class_SceneTree_method_create_timer>`.
As opposed to :ref:`Timer<class_Timer>`, it does not require the instantiation of a node. Commonly used to create a one-shot delay timer as in the following example:
::
func some_function():
print("Timer started.")
yield(get_tree().create_timer(1.0), "timeout")
print("Timer ended.")
The timer will be dereferenced after its time elapses. To preserve the timer, you can keep a reference to it. See :ref:`Reference<class_Reference>`.
Properties
----------
+---------------------------+-----------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`time_left<class_SceneTreeTimer_property_time_left>` |
+---------------------------+-----------------------------------------------------------+
Signals
-------
.. _class_SceneTreeTimer_signal_timeout:
- **timeout** **(** **)**
Emitted when the timer reaches 0.
Property Descriptions
---------------------
.. _class_SceneTreeTimer_property_time_left:
- :ref:`float<class_float>` **time_left**
+----------+----------------------+
| *Setter* | set_time_left(value) |
+----------+----------------------+
| *Getter* | get_time_left() |
+----------+----------------------+
The time remaining (in seconds).
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`