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/Chaining/RepeatForever/GDActionNodeRepeatForever.gd

42 lines
878 B
GDScript3
Raw Normal View History

2022-06-18 13:05:48 +02:00
class_name GDActionNodeRepeatForever extends GDActionNodeInstant
var action_repeat
func get_class() -> String:
return "GDActionNodeRepeatForever"
func _init(action, key, node).(action, key, node):
pass
func start_repeat(action_repeat, delay: float , speed: float):
self.action_repeat = action_repeat
self.delay = delay
self.speed = speed
_reset_value()
_run()
func _start_action():
_run_action_repeat()
func _on_action_object_completed(action_node):
action_node.disconnect("finished", self, "_on_action_object_completed")
_run_action_repeat()
func _run_action_repeat():
if not is_instance_valid(node):
finished()
return
var action_node = action_repeat._start_from_action(node, key, speed)
if not action_node.is_connected("finished", self, "_on_action_object_completed"):
action_node.connect("finished", self, "_on_action_object_completed")