This commit is contained in:
2025-05-20 08:24:38 -05:00
parent 6b2fa2b381
commit 36762682b8
8 changed files with 150 additions and 21 deletions

View File

@@ -8,21 +8,28 @@ enum ProcessType {
@export var processType:ProcessType = ProcessType.SEQUENTIAL;
var childIndex:int = 0
var eventGroupStarted:bool = false
func shouldAutoStart() -> bool:
return true
func start() -> void:
super.start()
# If sequential, start first child
if shouldAutoStart():
startEventGroup()
func startEventGroup() -> void:
eventGroupStarted = true
# This is called by the parent event to start the group
if processType == ProcessType.SEQUENTIAL:
childIndex = -1
nextChild()
# If parallel, start all children
elif processType == ProcessType.PARALLEL:
for child in childEvents:
startChild(child)
func update(delta:float) -> void:
super.update(delta)
@@ -42,6 +49,9 @@ func nextChild() -> void:
func isDone() -> bool:
if !super.isDone():
return false
if started && !eventGroupStarted:
return true
# If sequential, check if we've reached the end of the children
if processType == ProcessType.SEQUENTIAL:
@@ -66,6 +76,7 @@ func end() -> void:
func reset() -> void:
childIndex = -1
eventGroupStarted = false
for child in childEvents:
child.reset()
# Send to the parent to reset the extra events