feat: implemented PlayerStateMachine::force_state

This commit is contained in:
Sara 2025-06-11 14:21:25 +02:00
parent a885d50551
commit 69b1f267ea

View file

@ -114,7 +114,12 @@ void PlayerStateMachine::add_state() {
template <class TState> template <class TState>
void PlayerStateMachine::force_state() { void PlayerStateMachine::force_state() {
this->states[TState::get_class_static()]; PlayerState::StateID next{TState::get_class_static()};
if(next != this->current_state->get_class()) {
this->current_state->state_exited();
this->current_state = this->states[TState::get_class_static()];
this->current_state->state_entered();
}
} }
#endif // !PLAYER_STATES_H #endif // !PLAYER_STATES_H