33 lines
753 B
GDScript
33 lines
753 B
GDScript
extends StateMachine
|
|
|
|
func _ready() -> void:
|
|
add_state("darting")
|
|
state = states.darting
|
|
set_state(states.darting)
|
|
for state in states:
|
|
if state_matching_method_exists(state):
|
|
continue
|
|
else:
|
|
printerr("StateMachine -> State: " + state + " has no matching method in parent.")
|
|
push_error("StateMachine -> State: " + state + " has no matching method in parent.")
|
|
# _animation_logic()
|
|
|
|
|
|
# Game logic consequences of state
|
|
func _state_logic(delta):
|
|
#var state_action_ref = funcref(parent, self.state)
|
|
#parent.velocity = state_action_ref.call_func()
|
|
parent.execute_movement(delta)
|
|
|
|
|
|
func _get_transition(_delta):
|
|
return null
|
|
|
|
|
|
func _enter_state(_new_state, _previous_state):
|
|
pass
|
|
|
|
|
|
func _exit_state(_previous_state, _new_state):
|
|
pass
|