godot/doc/classes/Timer.xml

76 lines
2.8 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
2019-04-01 10:33:56 +00:00
<class name="Timer" inherits="Node" category="Core" version="3.2">
<brief_description>
A countdown timer.
</brief_description>
<description>
Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one shot" mode.
</description>
<tutorials>
</tutorials>
<demos>
</demos>
<methods>
<method name="is_stopped" qualifiers="const">
<return type="bool">
</return>
<description>
2017-12-30 01:08:54 +00:00
Returns [code]true[/code] if the timer is stopped.
</description>
</method>
<method name="start">
<return type="void">
</return>
<argument index="0" name="time_sec" type="float" default="-1">
</argument>
<description>
Starts the timer. Sets [code]wait_time[/code] to [code]time_sec[/code] if [code]time_sec &gt; 0[/code]. This also resets the remaining time to [code]wait_time[/code].
Note: this method will not resume a paused timer. See [member paused].
</description>
</method>
<method name="stop">
<return type="void">
</return>
<description>
Stops the timer.
</description>
</method>
</methods>
<members>
<member name="autostart" type="bool" setter="set_autostart" getter="has_autostart">
If [code]true[/code], the timer will automatically start when entering the scene tree. Default value: [code]false[/code].
</member>
<member name="one_shot" type="bool" setter="set_one_shot" getter="is_one_shot">
If [code]true[/code], the timer will stop when reaching 0. If [code]false[/code], it will restart. Default value: [code]false[/code].
</member>
2018-01-11 22:38:35 +00:00
<member name="paused" type="bool" setter="set_paused" getter="is_paused">
If [code]true[/code], the timer is paused and will not process until it is unpaused again, even if [method start] is called.
2018-01-11 22:38:35 +00:00
</member>
<member name="process_mode" type="int" setter="set_timer_process_mode" getter="get_timer_process_mode" enum="Timer.TimerProcessMode">
Processing mode. See [enum TimerProcessMode].
</member>
2018-01-11 22:38:35 +00:00
<member name="time_left" type="float" setter="" getter="get_time_left">
The timer's remaining time in seconds. Returns 0 if the timer is inactive.
Note: You cannot set this value. To change the timer's remaining time, use [member wait_time].
2018-01-11 22:38:35 +00:00
</member>
<member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time">
Wait time in seconds.
</member>
</members>
<signals>
<signal name="timeout">
<description>
Emitted when the timer reaches 0.
</description>
</signal>
</signals>
<constants>
2017-11-24 22:16:30 +00:00
<constant name="TIMER_PROCESS_PHYSICS" value="0" enum="TimerProcessMode">
Update the timer during the physics step at each frame (fixed framerate processing).
</constant>
2017-11-24 22:16:30 +00:00
<constant name="TIMER_PROCESS_IDLE" value="1" enum="TimerProcessMode">
Update the timer during the idle time at each frame.
</constant>
</constants>
</class>