Event Trigger Update
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
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
|
||||
|
||||
@@ -10,4 +20,15 @@ func start() -> void:
|
||||
super.start()
|
||||
|
||||
if ifCondition():
|
||||
startEventGroup()
|
||||
startEventGroup()
|
||||
|
||||
func onEventTrigger() -> void:
|
||||
if !ifCondition():
|
||||
return
|
||||
eventConditionMet.emit()
|
||||
|
||||
func onTriggerListening(_trigger:EventTrigger) -> void:
|
||||
subscribeEvents()
|
||||
|
||||
func onTriggerNotListening(_trigger:EventTrigger) -> void:
|
||||
unsubscribeEvents()
|
||||
|
Reference in New Issue
Block a user