feat: implemented PlayerStateMachine::force_state
This commit is contained in:
parent
a885d50551
commit
69b1f267ea
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue