- Install directly from Godot Asset Library
or
-
Download this respository, move
lowlevel-1989/object_state_machine
to your{project_dir}
-
Enable it from Project -> Settings -> Plugin
- To create a state machine add the NodeStateMachine to the desired object as shown in the demo.
to define a new state you must create a class from the StateAbstract class and define its behavior.
- void StateAbstract::create(owner·:·Node,·state_machine·:·StateMachine)
- Node StateAbstract::get_owner()
- void StateAbstract::transition_to(state:·StateAbstract)
- String StateAbstract::get_name()
- bool StateAbstract::is_class_state_machine()
- bool StateAbstract::is_class_state()
- void StateAbstract::_enter()
- void StateAbstract::_exit()
- void StateAbstract::_input(event : InputEvent)
- void StateAbstract::_process(delta : float)
- void StateAbstract::_physics_process(delta : float)
- void StateAbstract::_integrate_forces(state : Object)
- void StateAbstract::_confirm_transition()
- void StateAbstract::_set_name()
in charge of administering the states.
- transitioned(current : StateAbstract, next : StateAbstract)
- void StateMachine::create(name : String)
- void StateMachine::set_init_state(state : StateAbstract)
- void StateMachine::transition_debug_enable()
- void StateMachine::transition_debug_disable()
- StateAbstract StateMachine::get_current_state()
- StateAbstract StateMachine::get_prev_state()
- void StateMachine::transition_to(state : StateAbstract)
- void StateMachine::input(event : InputEvent)
- void StateMachine::process(delta : float)
- void StateMachine::physics_process(delta : float)
- void StateMachine::integrate_forces(state : Object)
- bool StateMachine::is_class_state_machine()
- bool StateMachine::is_class_state()