Refactor rhythm action architecture

This commit is contained in:
wxm
2026-07-02 09:47:52 -07:00
parent fc941cf08d
commit e62ed84518
124 changed files with 7516 additions and 2440 deletions

View File

@@ -0,0 +1,34 @@
class_name StateMachine
extends Node
signal state_changed(previous: int, current: int)
var current_state := 0
var state_names: Array[StringName] = [
&"ground",
&"ground",
&"air",
&"ground",
&"ground",
&"air",
&"guarding",
&"charging",
&"bladeChain",
&"burstCharge",
&"bursting",
&"hitstun",
]
func change_state(next_state: int) -> void:
if next_state == current_state:
return
var previous := current_state
current_state = next_state
state_changed.emit(previous, current_state)
func get_current_state_name() -> StringName:
if current_state >= 0 and current_state < state_names.size():
return state_names[current_state]
return &"any"