This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/addons/godot-action/GDAction/CustomAction/Perform/GDActionNodePerform.gd
2022-06-18 13:05:48 +02:00

38 lines
732 B
GDScript

class_name GDActionNodePerform extends GDActionNodeInstant
var on_target: Node
var args: Array = []
var selector: String = ""
func get_class() -> String:
return "GDActionNodePerform"
func _init(action, key, node).(action, key, node):
pass
func start_perform(selector: String, args: Array, on_target: Node, delay: float, speed: float):
self.selector = selector
self.args = args
self.on_target = on_target
self.delay = delay
self.speed = speed
_reset_value()
_run()
func _start_action():
_perform(selector, on_target, args)
func _perform(selector, on_target, args):
if on_target == null:
finished()
# on_target.call_deferred(selector)
# on_target.call(selector)
on_target.callv(selector, args)
finished()