class_scenetreetimer.rst 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/SceneTreeTimer.xml.
  6. .. _class_SceneTreeTimer:
  7. SceneTreeTimer
  8. ==============
  9. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. One-shot timer.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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>`.
  15. 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:
  16. ::
  17. func some_function():
  18. print("Timer started.")
  19. yield(get_tree().create_timer(1.0), "timeout")
  20. print("Timer ended.")
  21. 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>`.
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +---------------------------+-----------------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`time_left<class_SceneTreeTimer_property_time_left>` |
  29. +---------------------------+-----------------------------------------------------------+
  30. .. rst-class:: classref-section-separator
  31. ----
  32. .. rst-class:: classref-descriptions-group
  33. Signals
  34. -------
  35. .. _class_SceneTreeTimer_signal_timeout:
  36. .. rst-class:: classref-signal
  37. **timeout** **(** **)**
  38. Emitted when the timer reaches 0.
  39. .. rst-class:: classref-section-separator
  40. ----
  41. .. rst-class:: classref-descriptions-group
  42. Property Descriptions
  43. ---------------------
  44. .. _class_SceneTreeTimer_property_time_left:
  45. .. rst-class:: classref-property
  46. :ref:`float<class_float>` **time_left**
  47. .. rst-class:: classref-property-setget
  48. - void **set_time_left** **(** :ref:`float<class_float>` value **)**
  49. - :ref:`float<class_float>` **get_time_left** **(** **)**
  50. The time remaining (in seconds).
  51. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  52. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  53. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  54. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`