Conversation
This commit is contained in:
26
scripts/Events/Flow/EventWithChildren.gd
Normal file
26
scripts/Events/Flow/EventWithChildren.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
class_name EventWithChildren extends "res://scripts/Events/Event.gd"
|
||||
|
||||
var childEvents:Array[Event] = []
|
||||
|
||||
func _init() -> void:
|
||||
super._init()
|
||||
_updateChildEvents()
|
||||
_updateChildEvents()
|
||||
self.child_entered_tree.connect(onChildEntered)
|
||||
self.child_exiting_tree.connect(onChildExited)
|
||||
self.child_order_changed.connect(onChildOrderChanged)
|
||||
|
||||
func _updateChildEvents() -> void:
|
||||
childEvents = []
|
||||
for child in get_children():
|
||||
if child is Event:
|
||||
childEvents.append(child)
|
||||
|
||||
func onChildEntered(child:Node) -> void:
|
||||
_updateChildEvents()
|
||||
|
||||
func onChildExited(child:Node) -> void:
|
||||
_updateChildEvents()
|
||||
|
||||
func onChildOrderChanged() -> void:
|
||||
_updateChildEvents()
|
Reference in New Issue
Block a user