State machine rework

This commit is contained in:
Rendo 2025-12-09 22:34:17 +05:00
commit 87919ed890
25 changed files with 102 additions and 76 deletions

View file

@ -23,7 +23,6 @@ func on_transition_required(to: StringName):
return
change_state(states[to])
change_state_to_name.rpc(to)
func change_state(to_state: State) -> void:
if current_state != null:
@ -31,19 +30,6 @@ func change_state(to_state: State) -> void:
current_state = to_state
current_state.enter()
@rpc("authority","call_local","reliable")
func change_state_to_name(to_name: StringName):
if current_state != null:
current_state.exit()
current_state = states[to_name]
current_state.enter()
@rpc("authority","call_local","unreliable")
func clear_state():
if current_state == null:
return
current_state.exit()
current_state = null
func _process(delta: float) -> void:
if current_state == null: