i6engine  1.0
i6e::api::GameObject Class Reference

Class representing a GameObject in the i6engine. More...

#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/api/objects/GameObject.h>

Public Member Functions

 GameObject ()
 Constructor for GameObject. Sets the _objGoid with an ID given by GuidServer. The GameObject registers itself in the ObjectController. So deleting the Object shouldn't be necessary. More...
 
 GameObject (const int64_t goid, const core::IPKey &ownerNode, uint64_t uuid, const std::string &tpl, const boost::function< ComPtr(const int64_t, const std::string &, const attributeMap &, const WeakGOPtr &)> &f)
 
 ~GameObject ()
 Remove all GOCs held by the component table. More...
 
int64_t getID () const
 Returns the GUID of the GameObject. More...
 
ComPtr getGOC (uint32_t famID) const
 Returns a Pointer to the searched GOComponent, if it is in the component table otherwise NULL. More...
 
ComPtr getGOC (uint32_t famID, const std::string &identifier) const
 Returns a Pointer to the searched GOComponent, if it is in the component table otherwise NULL. More...
 
template<typename T >
utils::sharedPtr< T, api::ComponentgetGOC (uint32_t famID) const
 
template<typename T >
utils::sharedPtr< T, api::ComponentgetGOC (uint32_t famID, const std::string &identifier) const
 
template<typename T >
utils::sharedPtr< T, api::ComponentgetGOC () const
 
template<typename T >
utils::sharedPtr< T, api::ComponentgetGOC (const std::string &identifier) const
 
ComPtr getGOCID (const int64_t id) const
 Returns a Pointer to the searched GOComponent, if it is in the component table otherwise nullptr. More...
 
std::vector< ComPtrgetGOCList () const
 returns a list of all Components on this GameObject More...
 
void setGOC (const ComPtr &objNewGOC)
 Inserts objNewGOC into the component table. If a GOComponent of the same type already exists, it will be replaced. More...
 
void clearGOCs ()
 Remove all GOCs held by the component table. More...
 
void setDie () const
 Sends a message to delete this GameObject on the next Tick of the ObjectController. More...
 
std::string getType () const
 Returns the type of the GameObject. More...
 
void setType (const std::string &type)
 Sets the type of the GameObject. More...
 
void deleteGOC (uint32_t famID)
 Deletes a Component of the Game Object. More...
 
void deleteGOC (uint32_t famID, const std::string &identifier)
 Deletes a Component of the Game Object. More...
 
void sendCreateMessage () const
 
void synchronize (std::vector< GameMessage::Ptr > &messages, bool all) const
 adds synchronize messages for GameObject and all Components of this GO set param all false if you just want Components with sync flag to be added to message More...
 
void sendDeleteMessage () const
 sends a message to delete the GameObject More...
 
core::IPKey getOwner () const
 returns the owner of this gameObject More...
 
void News (const GameMessage::Ptr &msg)
 processes a message process messages for GameObjects or forwards messages concerning Components [in] msg Message to be processed More...
 
void initializeComponents ()
 calls Init for every Component on the GO More...
 
uint64_t getUUID () const
 returns the uuid of this GO More...
 
void setSelf (const WeakGOPtr &self)
 
void setFlags (const std::vector< std::string > &flags)
 stores the flags for which this GO is visible More...
 
std::vector< std::string > getFlags () const
 
void setSend (bool send)
 stores whether this object has to be synchronized or not More...
 
bool getSend () const
 
template<typename T >
utils::sharedPtr< T, ComponentgetGOC (uint32_t famID) const
 
template<typename T >
utils::sharedPtr< T, ComponentgetGOC (uint32_t famID, const std::string &identifier) const
 
template<typename T >
utils::sharedPtr< T, ComponentgetGOC () const
 
template<typename T >
utils::sharedPtr< T, ComponentgetGOC (const std::string &identifier) const
 

Detailed Description

Class representing a GameObject in the i6engine.

Every GameObject holds a list of Components characterizing this GameObject. These Components also can receive messages as they derive from MessageSubsriber.

Note
GameObject.h defines the types:
  • component_table_t is an alias for std::map<const goc_id_type, GOComponent*>.
  • component_table_pair_t is an alias for std::pair<const goc_id_type, GOComponent*>.
Have a look at here for an overview of typedef's in namespace i6engine.

Definition at line 70 of file GameObject.h.

Constructor & Destructor Documentation

i6e::api::GameObject::GameObject ( )
inline

Constructor for GameObject. Sets the _objGoid with an ID given by GuidServer. The GameObject registers itself in the ObjectController. So deleting the Object shouldn't be necessary.

Parameters
typeType of the created object

Definition at line 77 of file GameObject.h.

i6e::api::GameObject::GameObject ( const int64_t  goid,
const core::IPKey ownerNode,
uint64_t  uuid,
const std::string &  tpl,
const boost::function< ComPtr(const int64_t, const std::string &, const attributeMap &, const WeakGOPtr &)> &  f 
)
i6e::api::GameObject::~GameObject ( )

Remove all GOCs held by the component table.

Member Function Documentation

void i6e::api::GameObject::clearGOCs ( )

Remove all GOCs held by the component table.

void i6e::api::GameObject::deleteGOC ( uint32_t  famID)

Deletes a Component of the Game Object.

Parameters
[in]famIDFamilyID of the component, which you want to delete
void i6e::api::GameObject::deleteGOC ( uint32_t  famID,
const std::string &  identifier 
)

Deletes a Component of the Game Object.

Parameters
[in]famIDFamilyID of the component, which you want to delete
[in]identifierthe string identifier of the special component
std::vector<std::string> i6e::api::GameObject::getFlags ( ) const
inline

Definition at line 228 of file GameObject.h.

ComPtr i6e::api::GameObject::getGOC ( uint32_t  famID) const

Returns a Pointer to the searched GOComponent, if it is in the component table otherwise NULL.

Parameters
[in]objFamilyIDof type const goc_id_type&
Returns
the wanted Component's dispatcher
ComPtr i6e::api::GameObject::getGOC ( uint32_t  famID,
const std::string &  identifier 
) const

Returns a Pointer to the searched GOComponent, if it is in the component table otherwise NULL.

Parameters
[in]objFamilyIDof type const goc_id_type&
[in]identifierstring identifier of the component
Returns
the wanted Component
template<typename T >
utils::sharedPtr<T, api::Component> i6e::api::GameObject::getGOC ( uint32_t  famID) const
template<typename T >
utils::sharedPtr<T, api::Component> i6e::api::GameObject::getGOC ( uint32_t  famID,
const std::string &  identifier 
) const
template<typename T >
utils::sharedPtr<T, api::Component> i6e::api::GameObject::getGOC ( ) const
template<typename T >
utils::sharedPtr<T, api::Component> i6e::api::GameObject::getGOC ( const std::string &  identifier) const
template<typename T >
utils::sharedPtr<T, Component> i6e::api::GameObject::getGOC ( uint32_t  famID) const

Definition at line 281 of file GameObject.h.

template<typename T >
utils::sharedPtr<T, Component> i6e::api::GameObject::getGOC ( uint32_t  famID,
const std::string &  identifier 
) const

Definition at line 293 of file GameObject.h.

template<typename T >
utils::sharedPtr<T, Component> i6e::api::GameObject::getGOC ( ) const

Definition at line 315 of file GameObject.h.

template<typename T >
utils::sharedPtr<T, Component> i6e::api::GameObject::getGOC ( const std::string &  identifier) const

Definition at line 328 of file GameObject.h.

ComPtr i6e::api::GameObject::getGOCID ( const int64_t  id) const

Returns a Pointer to the searched GOComponent, if it is in the component table otherwise nullptr.

Parameters
[in]objFamilyIDof type const
Returns
the wanted GOComponent
std::vector<ComPtr> i6e::api::GameObject::getGOCList ( ) const

returns a list of all Components on this GameObject

int64_t i6e::api::GameObject::getID ( ) const
inline

Returns the GUID of the GameObject.

Returns
_objGoid

Definition at line 90 of file GameObject.h.

core::IPKey i6e::api::GameObject::getOwner ( ) const
inline

returns the owner of this gameObject

Definition at line 196 of file GameObject.h.

bool i6e::api::GameObject::getSend ( ) const
inline

Definition at line 239 of file GameObject.h.

std::string i6e::api::GameObject::getType ( ) const
inline

Returns the type of the GameObject.

Definition at line 157 of file GameObject.h.

uint64_t i6e::api::GameObject::getUUID ( ) const
inline

returns the uuid of this GO

Definition at line 213 of file GameObject.h.

void i6e::api::GameObject::initializeComponents ( )

calls Init for every Component on the GO

void i6e::api::GameObject::News ( const GameMessage::Ptr msg)

processes a message process messages for GameObjects or forwards messages concerning Components [in] msg Message to be processed

void i6e::api::GameObject::sendCreateMessage ( ) const
void i6e::api::GameObject::sendDeleteMessage ( ) const

sends a message to delete the GameObject

void i6e::api::GameObject::setDie ( ) const

Sends a message to delete this GameObject on the next Tick of the ObjectController.

void i6e::api::GameObject::setFlags ( const std::vector< std::string > &  flags)
inline

stores the flags for which this GO is visible

Definition at line 224 of file GameObject.h.

void i6e::api::GameObject::setGOC ( const ComPtr objNewGOC)

Inserts objNewGOC into the component table. If a GOComponent of the same type already exists, it will be replaced.

Parameters
[in]objNewGOCa GOComponent* argument
Exceptions
ISIXE_THROW_FAILUREwhen objNewGOC is NULL
void i6e::api::GameObject::setSelf ( const WeakGOPtr self)
inline

Definition at line 217 of file GameObject.h.

void i6e::api::GameObject::setSend ( bool  send)
inline

stores whether this object has to be synchronized or not

Definition at line 235 of file GameObject.h.

void i6e::api::GameObject::setType ( const std::string &  type)

Sets the type of the GameObject.

void i6e::api::GameObject::synchronize ( std::vector< GameMessage::Ptr > &  messages,
bool  all 
) const

adds synchronize messages for GameObject and all Components of this GO set param all false if you just want Components with sync flag to be added to message


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