pcce::GameObject Class Reference

GameObjects are used to hold any game related info the engine user wants. More...

#include <GameObject.h>

Inheritance diagram for pcce::GameObject:

pcce::PropertyBag

List of all members.

Public Member Functions

 GameObject (tGameObjectID id)
 Do not construct a game object directly. Use GameObjectDB.NewObject() instead.
 ~GameObject ()
bool IsRenderReady () const
bool IsPhysicsReady () const
std::string GetMaterialName () const
std::string GetRenderModelName () const
std::string GetPhysicsModelName () const
void SetMaterialName (const std::string &materialName)
void SetRenderModelName (const std::string &renderModelName)
void SetPhysicsModelName (const std::string &physicsModelName)
tGameObjectID GetID ()
bool HasEntity ()
Ogre::Entity * GetEntity ()
void SetEntity (Ogre::Entity *entity)
void ClearEntity ()

Private Attributes

tGameObjectID mID
Ogre::Entity * mEntity


Detailed Description

GameObjects are used to hold any game related info the engine user wants.

Definition at line 48 of file GameObject.h.


Constructor & Destructor Documentation

GameObject::GameObject ( tGameObjectID  id  ) 

Do not construct a game object directly. Use GameObjectDB.NewObject() instead.

Definition at line 40 of file GameObject.cpp.

References pcce::PropertyBag::AddProperty(), pcce::kMaterialNameProperty, pcce::kPhysicsModelNameProperty, pcce::kRenderModelNameProperty, and pcce::PropertyBag::SetValue().

GameObject::~GameObject (  ) 

Definition at line 51 of file GameObject.cpp.

00051                         {
00052 }


Member Function Documentation

bool GameObject::IsRenderReady (  )  const

bool GameObject::IsPhysicsReady (  )  const

Definition at line 58 of file GameObject.cpp.

References pcce::PropertyBag::HasValue(), and pcce::kPhysicsModelNameProperty.

00058                                       {
00059   return HasValue(kPhysicsModelNameProperty);
00060 }

std::string GameObject::GetMaterialName (  )  const

Definition at line 62 of file GameObject.cpp.

References pcce::Variant::AsString(), pcce::PropertyBag::GetValueDef(), pcce::Variant::HasValue(), pcce::kMaterialNameProperty, and pcce::Variant::Set().

00062                                             {
00063   Variant v = GetValueDef(kMaterialNameProperty, "");
00064   if (!v.HasValue()) {
00065     v.Set("");
00066   }
00067   return v.AsString();
00068 }

std::string GameObject::GetRenderModelName (  )  const

Definition at line 70 of file GameObject.cpp.

References pcce::Variant::AsString(), pcce::PropertyBag::GetValueDef(), pcce::Variant::HasValue(), pcce::kRenderModelNameProperty, and pcce::Variant::Set().

00070                                                {
00071   Variant v = GetValueDef(kRenderModelNameProperty, "");
00072   if (!v.HasValue()) {
00073     v.Set("");
00074   }
00075   return v.AsString();
00076 }

std::string GameObject::GetPhysicsModelName (  )  const

Definition at line 78 of file GameObject.cpp.

References pcce::Variant::AsString(), pcce::PropertyBag::GetValueDef(), pcce::Variant::HasValue(), pcce::kPhysicsModelNameProperty, and pcce::Variant::Set().

00078                                                 {
00079   Variant v = GetValueDef(kPhysicsModelNameProperty, "");
00080   if (!v.HasValue()) {
00081     v.Set("");
00082   }
00083   return v.AsString();
00084 }

void GameObject::SetMaterialName ( const std::string &  materialName  ) 

Definition at line 86 of file GameObject.cpp.

References pcce::kMaterialNameProperty, mEntity, and pcce::PropertyBag::SetValue().

00086                                                               {
00087   SetValue(kMaterialNameProperty, materialName);
00088   if (mEntity != NULL) {
00089     mEntity->setMaterialName(materialName);
00090   }
00091 }

void GameObject::SetRenderModelName ( const std::string &  renderModelName  ) 

Definition at line 93 of file GameObject.cpp.

References pcce::kRenderModelNameProperty, mEntity, PCCE_CHECK, and pcce::PropertyBag::SetValue().

00093                                                                     {
00094   PCCE_CHECK(mEntity == NULL, "GameObject::SetRenderModelName: Cannot change render model after game object has entity");
00095   SetValue(kRenderModelNameProperty, renderModelName);
00096 }

void GameObject::SetPhysicsModelName ( const std::string &  physicsModelName  ) 

Definition at line 98 of file GameObject.cpp.

References pcce::kPhysicsModelNameProperty, and pcce::PropertyBag::SetValue().

00098                                                                       {
00099   SetValue(kPhysicsModelNameProperty, physicsModelName);
00100 }

tGameObjectID GameObject::GetID (  ) 

Definition at line 102 of file GameObject.cpp.

References mID.

00102                                 {
00103   return mID;
00104 }

bool GameObject::HasEntity (  ) 

Definition at line 106 of file GameObject.cpp.

References mEntity.

00106                            {
00107   return mEntity == NULL;
00108 }

Ogre::Entity * GameObject::GetEntity (  ) 

Definition at line 110 of file GameObject.cpp.

References mEntity.

00110                                   {
00111   return mEntity;
00112 }

void GameObject::SetEntity ( Ogre::Entity *  entity  ) 

Definition at line 114 of file GameObject.cpp.

References mEntity, and PCCE_CHECK.

00114                                              {
00115   PCCE_CHECK(
00116     (mEntity == NULL) || (entity == NULL), "GameObject::SetEntity: Game object already has an entity");
00117   mEntity = entity;
00118 }

void GameObject::ClearEntity (  ) 

Definition at line 120 of file GameObject.cpp.

References mEntity.

00120                              {
00121   mEntity = NULL;
00122 }


Member Data Documentation

Definition at line 73 of file GameObject.h.

Referenced by GetID().

Ogre::Entity* pcce::GameObject::mEntity [private]


The documentation for this class was generated from the following files:

Generated on Thu Mar 6 11:39:28 2008 for Protocce by  doxygen 1.5.5