The Nebula Device 3: BaseGameFeature::GameStateHandler Class Reference

The Nebula Device 3

BaseGameFeature::GameStateHandler Class Reference

#include <gamestatehandler.h>


Detailed Description

The GameStateHandler creates the basegamefeature and attached it to the gameserver. It uses the basegamefeature to load a level, a savegame or setups a new game or just an empty world.

The basegamefeature does the specific game logic stuff, like handling entities with the entitymanager and factorymanager and so on.

(C) 2003 RadonLabs GmbH

Public Types

enum  SetupMode
 setup modes

Public Member Functions

 GameStateHandler ()
 constructor
virtual ~GameStateHandler ()
 destructor
virtual void OnStateEnter (const Util::String &prevState)
 called when the state represented by this state handler is entered
virtual void OnStateLeave (const Util::String &nextState)
 called when the state represented by this state handler is left
virtual Util::String OnFrame ()
 called each frame as long as state is current, return new state
void SetSetupMode (SetupMode mode)
 set the setup mode
SetupMode GetSetupMode () const
 get the setup mode
void SetLevelName (const Util::String &n)
 set level filename, required by setup mode LoadLevel
const Util::StringGetLevelName () const
 get level name
void SetSaveGame (const Util::String &n)
 set save game name, required by setup mode LoadSaveGame
const Util::StringGetSaveGame () const
 get save game name

Member Function Documentation

void BaseGameFeature::GameStateHandler::OnStateEnter ( const Util::String prevState  )  [virtual]

called when the state represented by this state handler is entered

This method is called when the state associated with this state handler is entered. The parameter indicates the previously active state.

Parameters:
prevState previous state

void BaseGameFeature::GameStateHandler::OnStateLeave ( const Util::String nextState  )  [virtual]

called when the state represented by this state handler is left

This method is called when the state associated with this state handler is left. The parameter indicates the next active state.

Parameters:
nextState next state

Util::String BaseGameFeature::GameStateHandler::OnFrame (  )  [virtual]

called each frame as long as state is current, return new state

This method is called once a frame while the state is active. The method must return a state identifier. If this is different from the current state, a state switch will occur after the method returns.

Returns:
a state identifier