forked from team-sg/hero-mark-2
state chart updates
This commit is contained in:
parent
d11ccb37a1
commit
02b85c7dd2
7 changed files with 242 additions and 18 deletions
21
addons/godot_state_charts/state_chart_debug.gd
Normal file
21
addons/godot_state_charts/state_chart_debug.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
class_name StateChartDebug
|
||||
extends Tree
|
||||
|
||||
var target: StateChart = null
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if target is StateChart:
|
||||
clear()
|
||||
var root_state = target.get_child(0)
|
||||
if root_state is State:
|
||||
var item = create_item(null)
|
||||
item.set_text(0, root_state.name)
|
||||
_find_active_states(root_state, item)
|
||||
|
||||
func _find_active_states(state: State, state_item: TreeItem):
|
||||
for child in state.get_children():
|
||||
if child is State:
|
||||
if child.active:
|
||||
var item := create_item(state_item)
|
||||
item.set_text(0, child.name)
|
||||
_find_active_states(child, item)
|
Loading…
Add table
Add a link
Reference in a new issue