igor::iEntity Class Reference

#include <iEntity.h>

Public Member Functions

 iEntity ()=default
 
 iEntity (const iEntity &other)=default
 
 iEntity (iEntityID entity, iEntityScenePtr scene)
 
iEntityID getID () const
 
bool isValid () const
 
const iaString getName () const
 
void setName (const iaString &name)
 
bool isActive () const
 
void setActive (bool active)
 
void addBehaviour (const iBehaviourDelegate &behaviour, const std::any &userData=std::any())
 
void removeBehaviour (const iBehaviourDelegate &behaviour)
 
void setParent (iEntityID parent)
 
iEntityID getParent () const
 
void setMotionInteractionType (iMotionInteractionType interactionType)
 
iMotionInteractionType getMotionInteractionType () const
 
template<typename T >
T & addComponent (const T &component)
 
template<typename T >
T & addUserComponent (const T &component)
 
template<typename T >
T & getComponent ()
 
template<typename T >
T & getUserComponent ()
 
template<typename T >
T * tryGetComponent () const
 
template<typename T >
T * tryGetUserComponent () const
 
template<typename T >
void removeComponent ()
 

Detailed Description

entity

Constructor & Destructor Documentation

◆ iEntity() [1/3]

igor::iEntity::iEntity ( )
default

does nothing

◆ iEntity() [2/3]

igor::iEntity::iEntity ( const iEntity other)
default

copy ctor

Parameters
otherthe entity to make a copy from

◆ iEntity() [3/3]

igor::iEntity::iEntity ( iEntityID  entity,
iEntityScenePtr  scene 
)

param ctor

Parameters
entitythe entity handle
scenethe scene this entity belongs to

Member Function Documentation

◆ addBehaviour()

void igor::iEntity::addBehaviour ( const iBehaviourDelegate behaviour,
const std::any &  userData = std::any() 
)

adds behaviour to entity

Parameters
behaviourthe behaviour to be added
userDatauser data added to behaviour

◆ addComponent()

template<typename T >
T & igor::iEntity::addComponent ( const T &  component)
inline

adds component to entity

Parameters
componentthe component to add

◆ addUserComponent()

template<typename T >
T & igor::iEntity::addUserComponent ( const T &  component)
inline

◆ getComponent()

template<typename T >
T & igor::iEntity::getComponent ( )
inline
Returns
component of entity of given type

◆ getID()

iEntityID igor::iEntity::getID ( ) const
Returns
entity id

◆ getMotionInteractionType()

iMotionInteractionType igor::iEntity::getMotionInteractionType ( ) const
Returns
motion interaction type

◆ getName()

const iaString igor::iEntity::getName ( ) const
Returns
entity name

◆ getParent()

iEntityID igor::iEntity::getParent ( ) const
Returns
the parent id or invalid id if there is no parent

◆ getUserComponent()

template<typename T >
T & igor::iEntity::getUserComponent ( )
inline

◆ isActive()

bool igor::iEntity::isActive ( ) const
Returns
true if entity is active

◆ isValid()

bool igor::iEntity::isValid ( ) const
Returns
true if entity is valid

◆ removeBehaviour()

void igor::iEntity::removeBehaviour ( const iBehaviourDelegate behaviour)

removes behaviour from entity

Parameters
behaviourthe behaviour to be removed

◆ removeComponent()

template<typename T >
void igor::iEntity::removeComponent ( )
inline

removes component of given type

◆ setActive()

void igor::iEntity::setActive ( bool  active)

sets entity active

Parameters
activeif true entity is active

◆ setMotionInteractionType()

void igor::iEntity::setMotionInteractionType ( iMotionInteractionType  interactionType)

sets motion interaction type

Parameters
interactionTypethe motion interaction type

◆ setName()

void igor::iEntity::setName ( const iaString name)

sets name of entity

Parameters
namethe name to set

◆ setParent()

void igor::iEntity::setParent ( iEntityID  parent)

set parent of entity

Parameters
parentthe parent id to use. if parent id invalid the parent relationship is reset

◆ tryGetComponent()

template<typename T >
T * igor::iEntity::tryGetComponent ( ) const
inline
Returns
component of entity of given type

returns nullptr in case component does not exist

◆ tryGetUserComponent()

template<typename T >
T * igor::iEntity::tryGetUserComponent ( ) const
inline

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