2#include <game/sLib/s_StateMgr.hpp>
6 virtual void changeToSubState(
const sStateIDIf_c &newState) = 0;
7 virtual void returnState() = 0;
8 virtual bool isSubState()
const = 0;
12template <
class T,
template <
class,
class>
class Manager,
class Method1,
class Method2>
15 sStateStateMgr_c(T &owner,
const sStateIDIf_c &initialState) :
16 mainMgr(owner, initialState),
17 subMgr(owner, initialState),
18 currentMgr(&mainMgr) {}
26 currentMgr->finalizeState();
30 virtual bool isSubState()
const {
return currentMgr == &subMgr; }
32 virtual void returnState() {
34 currentMgr->finalizeState();
35 currentMgr = &mainMgr;
43 virtual void changeToSubState(
const sStateIDIf_c &newState) {
52 virtual const sStateIDIf_c *getMainStateID()
const {
return mainMgr.getStateID(); }
54 Manager<T, Method1> mainMgr;
55 Manager<T, Method2> subMgr;
56 sStateMgrIf_c *currentMgr;
The interface for state IDs.
The interface for a state holder.
The interface for state managers.
virtual void changeState(const sStateIDIf_c &newStateID)=0
Transitions to a new state ID.
virtual void initializeState()
Initializes the current state.
virtual void changeState(const sStateIDIf_c &newState)
Transitions to a new state ID.
virtual void executeState()
Executes the current state.
virtual void finalizeState()
Prepares the current state for termination.
virtual const sStateIDIf_c * getOldStateID() const
Gets the previous state ID.
virtual sStateIf_c * getState() const
Gets the state holder.
virtual const sStateIDIf_c * getNewStateID() const
Gets the next state ID.
virtual const sStateIDIf_c * getStateID() const
Gets the current state ID.
virtual void refreshState()
Marks the current state to be executed again.