SceneTreeTimer.xml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="SceneTreeTimer" inherits="Reference" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. One-shot timer.
  5. </brief_description>
  6. <description>
  7. A one-shot timer managed by the scene tree, which emits [signal timeout] on completion. See also [method SceneTree.create_timer].
  8. As opposed to [Timer], it does not require the instantiation of a node. Commonly used to create a one-shot delay timer as in the following example:
  9. [codeblock]
  10. func some_function():
  11. print("Timer started.")
  12. yield(get_tree().create_timer(1.0), "timeout")
  13. print("Timer ended.")
  14. [/codeblock]
  15. The timer will be dereferenced after its time elapses. To preserve the timer, you can keep a reference to it. See [Reference].
  16. </description>
  17. <tutorials>
  18. </tutorials>
  19. <methods>
  20. </methods>
  21. <members>
  22. <member name="time_left" type="float" setter="set_time_left" getter="get_time_left">
  23. The time remaining (in seconds).
  24. </member>
  25. </members>
  26. <signals>
  27. <signal name="timeout">
  28. <description>
  29. Emitted when the timer reaches 0.
  30. </description>
  31. </signal>
  32. </signals>
  33. <constants>
  34. </constants>
  35. </class>