Rework player state system to use an event subscription system to avoid directly calling methods on individual state and having to worry about validity
This commit is contained in:
@@ -25,6 +25,11 @@ func QueueStateChange(to_state_enum: PlayerStateMachine.States, extra_parameters
|
||||
queued_parameters = extra_parameters
|
||||
|
||||
|
||||
func SendEventToCurrentStateIfValid(signal_name: String, parameters: Variant = null) -> void:
|
||||
if current_state._subscribed_events.has(signal_name):
|
||||
current_state._StateMachine_OnEventSent(signal_name, parameters)
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var children := states_container.get_children()
|
||||
|
||||
Reference in New Issue
Block a user