mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 06:09:46 +03:00
Fix incorrect comment in hierarchical FSM demo script
This closes #433.
This commit is contained in:
@@ -7,10 +7,9 @@ extends Node
|
||||
|
||||
signal state_changed(current_state)
|
||||
|
||||
# You must set a starting node from the inspector or on
|
||||
# the node that inherits from this state machine interface.
|
||||
# If you don't the game will crash (on purpose, so you won't
|
||||
# forget to initialize the state machine).
|
||||
# You should set a starting node from the inspector or on the node that inherits
|
||||
# from this state machine interface. If you don't, the game will default to
|
||||
# the first state in the state machine's children.
|
||||
export(NodePath) var start_state
|
||||
var states_map = {}
|
||||
|
||||
@@ -60,14 +59,14 @@ func _change_state(state_name):
|
||||
if not _active:
|
||||
return
|
||||
current_state.exit()
|
||||
|
||||
|
||||
if state_name == "previous":
|
||||
states_stack.pop_front()
|
||||
else:
|
||||
states_stack[0] = states_map[state_name]
|
||||
|
||||
|
||||
current_state = states_stack[0]
|
||||
emit_signal("state_changed", current_state)
|
||||
|
||||
|
||||
if state_name != "previous":
|
||||
current_state.enter()
|
||||
|
||||
Reference in New Issue
Block a user