Files
Dawn-Godot/scripts/Event/Condition/EventIf.gd
2025-06-09 09:24:32 -05:00

35 lines
763 B
GDScript

class_name EventIf extends "res://scripts/Event/Flow/EventGroup.gd"
signal eventConditionMet
func ifCondition() -> bool:
return false
func subscribeEvents() -> void:
# Override this method to subscribe to any events needed for the condition check
pass
func unsubscribeEvents() -> void:
# Override this method to unsubscribe from any events when the condition is no longer needed
pass
func shouldAutoStart() -> bool:
return false
func start() -> void:
super.start()
if ifCondition():
startEventGroup()
func onEventTrigger() -> void:
if !ifCondition():
return
eventConditionMet.emit()
func onTriggerListening(_trigger:EventTrigger) -> void:
subscribeEvents()
func onTriggerNotListening(_trigger:EventTrigger) -> void:
unsubscribeEvents()