Dragonfly  4.3
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::StateMachine Class Reference
Collaboration diagram for df::StateMachine:
Collaboration graph
[legend]

Public Member Functions

 StateMachine ()
 
void setOwner (Object *p_new_owner)
 
ObjectgetOwner () const
 
void setState (State *p_new_state)
 
StategetState () const
 
void setPreviousState (State *p_new_state)
 
StategetPreviousState () const
 
void setGlobalState (State *p_new_state)
 
StategetGlobalState () const
 
void Update ()
 
void changeState (State *p_new_state)
 
void revertToPrevious ()
 

Private Attributes

Objectm_p_owner
 
Statem_p_state
 
Statem_p_previous_state
 
Statem_p_global_state
 

Constructor & Destructor Documentation

df::StateMachine::StateMachine ( )

Global state (reachable from any state).

Member Function Documentation

void df::StateMachine::changeState ( State p_new_state)

Change current state.

State* df::StateMachine::getGlobalState ( ) const

Get global state.

Object* df::StateMachine::getOwner ( ) const

Get owner of state machine.

State* df::StateMachine::getPreviousState ( ) const

Get previous state.

State* df::StateMachine::getState ( ) const

Get current state.

void df::StateMachine::revertToPrevious ( )

Revert to previous state.

void df::StateMachine::setGlobalState ( State p_new_state)

Set global state.

void df::StateMachine::setOwner ( Object p_new_owner)

Set owner of state machine.

void df::StateMachine::setPreviousState ( State p_new_state)

Set previous state.

void df::StateMachine::setState ( State p_new_state)

Set current state.

void df::StateMachine::Update ( )

Update state machine (calling Execute() for current state).

Member Data Documentation

State* df::StateMachine::m_p_global_state
private

Previous state.

State* df::StateMachine::m_p_previous_state
private

Current state.

State* df::StateMachine::m_p_state
private

Owner of this state machine.