The Nebula Device 3: Game::FeatureUnit Class Reference

The Nebula Device 3

Game::FeatureUnit Class Reference

#include <featureunit.h>

Inheritance diagram for Game::FeatureUnit:

Core::RefCounted


Detailed Description

A FeatureUnit is an encapsulated feature which can be added to an application. E.g. game features can be core features of Nebula3 like Render or Network, or it can be some of the addons like db or physics.

To add a new feature, derive from this class and add it to the Game::GameServer on application or statehandler startup.

The Game::GameServer will start, load, save, trigger and close your feature.

(C) 2007 Radon Labs GmbH

Public Member Functions

 FeatureUnit ()
 constructor
virtual ~FeatureUnit ()
 destructor
virtual void OnActivate ()
 called from GameServer::ActivateProperties()
virtual void OnDeactivate ()
 called from GameServer::DeactivateProperties()
bool IsActive () const
 return true if property is currently active
virtual void OnLoad ()
 called from within GameServer::Load() after attributes are loaded
virtual void OnStart ()
 called from within GameServer::OnStart() after OnLoad when the complete world exist
virtual void OnSave ()
 called from within GameServer::Save() before attributes are saved back to database
virtual void OnBeginFrame ()
 called on begin of frame
virtual void OnFrame ()
 called in the middle of the feature trigger cycle
virtual void OnEndFrame ()
 called at the end of the feature trigger cycle
virtual void OnRenderDebug ()
 called when game debug visualization is on
virtual void AttachManager (const Ptr< Manager > &manager)
 attach a manager to the game world
virtual void RemoveManager (const Ptr< Manager > &manager)
 remove a manager from the game world
void SetCmdLineArgs (const Util::CmdLineArgs &a)
 set command line args
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Member Function Documentation

void Game::FeatureUnit::OnActivate (  )  [virtual]

called from GameServer::ActivateProperties()

This method is called by Game::GameServer::ActivateProperties(). Use this method for one-time initializations of the FeatureUnit.

void Game::FeatureUnit::OnDeactivate (  )  [virtual]

called from GameServer::DeactivateProperties()

This method is called by Game::GameServer::DeactivateProperties(). Use this method to cleanup stuff which has been initialized in OnActivate().

void Game::FeatureUnit::OnLoad (  )  [virtual]

called from within GameServer::Load() after attributes are loaded

This method is called from within Game::GameServer::Load() on load of a savegame.

void Game::FeatureUnit::OnStart (  )  [virtual]

called from within GameServer::OnStart() after OnLoad when the complete world exist

This method is called from within Game::GameServer::OnStart(). Its called after all game features are activated and have initialized their subsystems. Use this

void Game::FeatureUnit::OnSave (  )  [virtual]

called from within GameServer::Save() before attributes are saved back to database

This method is called from within Game::GameServer::Save(). It's called on save of a game.

void Game::FeatureUnit::OnBeginFrame (  )  [virtual]

called on begin of frame

This method is called from Game::GameServer::OnBeginFrame() on all game features attached to an GameServer in the order of attachment. Override this method if your FeatureUnit has to do any work at the beginning of the frame.

void Game::FeatureUnit::OnFrame (  )  [virtual]

called in the middle of the feature trigger cycle

This method is called from Game::GameServer::OnMoveBefore() on all game features attached to an GameServer in the order of attachment. Override this method if your FeatureUnit has any work to do before the physics subsystem is triggered.

void Game::FeatureUnit::OnEndFrame (  )  [virtual]

called at the end of the feature trigger cycle

This method is called from Game::GameServer::OnRender() on all game features attached to an GameServer in the order of attachment. Override this method if your FeatureUnit has any work to do before rendering happens.

void Game::FeatureUnit::OnRenderDebug (  )  [virtual]

called when game debug visualization is on

This method is called from Game::GameServer::OnRenderDebug() on all game features attached to an GameServer in the order of attachment. It's meant for debug issues. It will be called when debug mode is enabled.

void Game::FeatureUnit::AttachManager ( const Ptr< Manager > &  manager  )  [virtual]

attach a manager to the game world

Attach a manager object to the game world. The manager's OnActivate() method will be called once right away, and then its OnFrame() method once per frame.

void Game::FeatureUnit::RemoveManager ( const Ptr< Manager > &  manager  )  [virtual]

remove a manager from the game world

Remove a manager object from the game world. The manager's OnDeactivate() method will be called.

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.