Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
SceneTreeTimer
Eredita: RefCounted < Object
Timer a colpo singolo.
Descrizione
Un timer a colpo singolo gestito dall'albero di scene, che emette timeout al completamento. Vedi anche SceneTree.create_timer().
A differenza di Timer, non richiede l'istanziazione di un nodo. Comunemente utilizzato per creare un timer di ritardo a colpo singolo come nel seguente esempio:
func some_function():
print("Timer started.")
await get_tree().create_timer(1.0).timeout
print("Timer ended.")
public async Task SomeFunction()
{
GD.Print("Timer started.");
await ToSignal(GetTree().CreateTimer(1.0f), SceneTreeTimer.SignalName.Timeout);
GD.Print("Timer ended.");
}
Il timer verrà dereferenziato dopo che il suo tempo è trascorso. Per conservare il timer, puoi mantenere un riferimento ad esso. Vedi RefCounted.
Nota: Il timer viene elaborato dopo tutti i nodi nel frame attuale, ovvero il metodo Node._process() del nodo verrebbe chiamato prima del timer (o Node._physics_process() se process_in_physics in SceneTree.create_timer() è stato impostato su true).
Proprietà
Segnali
timeout() 🔗
Emesso quando il timer raggiunge 0.
Descrizioni delle proprietà
Il tempo rimanente (in secondi).