35 lines
496 B
GDScript
35 lines
496 B
GDScript
class_name GDDelay
|
|
extends RJSequenceAction
|
|
|
|
@export var duration = 1
|
|
@export var message = "huhu"
|
|
|
|
var running = false
|
|
var elapsed = 0;
|
|
var id = 0;
|
|
var cachedIDs = []
|
|
|
|
func _onTrigger():
|
|
if running:
|
|
cachedIDs
|
|
|
|
|
|
running = true
|
|
elapsed = 0
|
|
id = dispatchStart()
|
|
|
|
func _process( delta ):
|
|
if ! running:
|
|
return
|
|
elapsed += delta
|
|
|
|
if elapsed > duration:
|
|
running = false
|
|
elapsed = 0
|
|
print( name + " >> " + message )
|
|
dispatchEnd( id )
|
|
|
|
|
|
|
|
|