IEntityClass

C++
struct IEntityClass {
  enum EventValueType {
    EVT_INT,
    EVT_FLOAT,
    EVT_BOOL,
    EVT_VECTOR,
    EVT_ENTITY,
    EVT_STRING
  };
  struct SEventInfo {
    const char * name;
    EventValueType type;
    bool bOutput;
  };
};
File

IEntityClass.h

Description

Entity class defines what is this entity, what script it uses, what user proxy will be spawned with the entity,etc... IEntityClass unique identify type of the entity, Multiple entities share the same entity class. Two entities can be compared if they are of the same type by just comparing their IEntityClass pointers.

IEntityClass::EventValueType Enumeration
C++
enum EventValueType {
  EVT_INT,
  EVT_FLOAT,
  EVT_BOOL,
  EVT_VECTOR,
  EVT_ENTITY,
  EVT_STRING
};
File

IEntityClass.h

Description

Events info for this entity class.

IEntityClass::SEventInfo Structure
C++
struct SEventInfo {
  const char * name;
  EventValueType type;
  bool bOutput;
};
File

IEntityClass.h

Members
Members
Description
const char * name;
Name of event.
EventValueType type;
Type of event value.
bool bOutput;
Input or Output event.
IEntityClass::~IEntityClass Destructor
C++
virtual ~IEntityClass();
IEntityClass::FindEventInfo Method
C++
virtual bool FindEventInfo(const char * sEvent, SEventInfo & event) = 0;
Parameters
Parameters
Description
const char * sEvent
Name of the event.
SEventInfo & event
Output parameter for event.
Returns

True if event found and event parameter is initialized.

Description

Find event by name.

See Also
IEntityClass::GetEditorClassInfo Method
C++
virtual const SEditorClassInfo& GetEditorClassInfo() const = 0;
IEntityClass::GetEventCount Method
C++
virtual int GetEventCount() = 0;
Returns

Return Number of events.

Description

Returns number of input and output events defiend in the entity script.

See Also
IEntityClass::GetEventHandler Method
C++
virtual IEntityEventHandler* GetEventHandler() const = 0;
IEntityClass::GetEventInfo Method
C++
virtual IEntityClass::SEventInfo GetEventInfo(int nIndex) = 0;
Parameters
Parameters
Description
int nIndex
Index of the event to retrieve, must be in 0 to GetEventCount()-1 range.
Returns

Specified event description in SEventInfo structure.

Description

Retrieve information about input/output event of the entity.

See Also
IEntityClass::GetFlags Method
C++
virtual uint32 GetFlags() const = 0;
Description

Returns entity class flags.

See Also
IEntityClass::GetIEntityScript Method
C++
virtual IEntityScript* GetIEntityScript() const = 0;
Returns

IEntityScript interface if this entity have script, or NULL if no script defined for this entity class.

Description

Returns the IEntityScript interface assigned for this entity class.

IEntityClass::GetMemoryUsage Method
C++
virtual void GetMemoryUsage(ICrySizer * pSizer) const = 0;
IEntityClass::GetName Method
C++
virtual const char* GetName() const = 0;
Description

Returns the name of the entity class, Class name must be unique among all the entity classes. If this entity also uses a script, this is the name of the Lua table representing the entity behavior.

IEntityClass::GetPropertyHandler Method
C++
virtual IEntityPropertyHandler* GetPropertyHandler() const = 0;
IEntityClass::GetScriptFile Method
C++
virtual const char* GetScriptFile() const = 0;
Returns

Lua Script filename, return empty string if entity does not use script.

Description

Returns the Lua script file name.

IEntityClass::GetScriptFileHandler Method
C++
virtual IEntityScriptFileHandler* GetScriptFileHandler() const = 0;
IEntityClass::GetScriptTable Method
C++
virtual IScriptTable* GetScriptTable() const = 0;
Returns

IScriptTable interface if this entity have script, or NULL if no script defined for this entity class.

Description

Returns the IScriptTable interface assigned for this entity class.

IEntityClass::GetUserProxyCreateFunc Method
C++
virtual IEntityClass::UserProxyCreateFunc GetUserProxyCreateFunc() const = 0;
Returns

Return ContainerCreateFunc function pointer.

Description

Returns pointer to the user defined function to create UserProxy.

IEntityClass::GetUserProxyData Method
C++
virtual void* GetUserProxyData() const = 0;
Returns

Return ContainerCreateFunc function pointer.

Description

Returns pointer to the user defined function to create UserProxy.

IEntityClass::LoadScript Method
C++
virtual bool LoadScript(bool bForceReload) = 0;
Description

Loads the script. It is safe to call LoadScript multiple times, only first time the script will be loaded, if bForceReload is not specified.

IEntityClass::Release Method
C++
virtual void Release() = 0;
Description

Destroy IEntityClass object, do not call directly, only EntityRegisty can destroy entity classes.

IEntityClass::SetEditorClassInfo Method
C++
virtual void SetEditorClassInfo(const SEditorClassInfo& editorClassInfo) = 0;
IEntityClass::SetFlags Method
C++
virtual void SetFlags(uint32 nFlags) = 0;
Description

Set entity class flags.

See Also
IEntityClass::UserProxyCreateFunc Nested Type
C++
typedef IEntityProxyPtr (* UserProxyCreateFunc)(IEntity *pEntity, SEntitySpawnParams &params, void *pUserData);
Description

UserProxyCreateFunc is a function pointer type, by calling this function EntitySystem can create user defined UserProxy class for an entity in SpawnEntity. Ex: IEntityProxy* CreateUserProxy( IEntity *pEntity,SEntitySpawnParams &params ) { return new CUserProxy( pEntity,params );