1234567891011121314151617181920 |
- #pragma once
- #include "lfr_state_interface.h"
-
- class LFR_StateMachine
- {
- LFR_IState* currentState;
- LFR_StateMachine() = delete;
- public:
- LFR_StateMachine(LFR_IState& startState){
- currentState = &startState;
- currentState->enter(this);
- }
- inline LFR_IState* getCurrentState() const {return currentState;}
- void setState(LFR_IState& newState)
- {
- currentState->exit(this);
- currentState = &newState;
- currentState->enter(this);
- }
- };
|