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; }; };
IEntityClass.h
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.
enum EventValueType { EVT_INT, EVT_FLOAT, EVT_BOOL, EVT_VECTOR, EVT_ENTITY, EVT_STRING };
IEntityClass.h
Events info for this entity class.
struct SEventInfo { const char * name; EventValueType type; bool bOutput; };
IEntityClass.h
Members |
Description |
const char * name; |
Name of event. |
EventValueType type; |
Type of event value. |
bool bOutput; |
Input or Output event. |
virtual ~IEntityClass();
virtual bool FindEventInfo(const char * sEvent, SEventInfo & event) = 0;
Parameters |
Description |
const char * sEvent |
Name of the event. |
SEventInfo & event |
Output parameter for event. |
True if event found and event parameter is initialized.
Find event by name.
virtual const SEditorClassInfo& GetEditorClassInfo() const = 0;
virtual int GetEventCount() = 0;
Return Number of events.
Returns number of input and output events defiend in the entity script.
virtual IEntityEventHandler* GetEventHandler() const = 0;
virtual IEntityClass::SEventInfo GetEventInfo(int nIndex) = 0;
Parameters |
Description |
int nIndex |
Index of the event to retrieve, must be in 0 to GetEventCount()-1 range. |
Specified event description in SEventInfo structure.
Retrieve information about input/output event of the entity.
virtual uint32 GetFlags() const = 0;
Returns entity class flags.
virtual IEntityScript* GetIEntityScript() const = 0;
IEntityScript interface if this entity have script, or NULL if no script defined for this entity class.
Returns the IEntityScript interface assigned for this entity class.
virtual void GetMemoryUsage(ICrySizer * pSizer) const = 0;
virtual const char* GetName() const = 0;
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.
virtual IEntityPropertyHandler* GetPropertyHandler() const = 0;
virtual const char* GetScriptFile() const = 0;
Lua Script filename, return empty string if entity does not use script.
Returns the Lua script file name.
virtual IEntityScriptFileHandler* GetScriptFileHandler() const = 0;
virtual IScriptTable* GetScriptTable() const = 0;
IScriptTable interface if this entity have script, or NULL if no script defined for this entity class.
Returns the IScriptTable interface assigned for this entity class.
virtual IEntityClass::UserProxyCreateFunc GetUserProxyCreateFunc() const = 0;
Return ContainerCreateFunc function pointer.
Returns pointer to the user defined function to create UserProxy.
virtual void* GetUserProxyData() const = 0;
Return ContainerCreateFunc function pointer.
Returns pointer to the user defined function to create UserProxy.
virtual bool LoadScript(bool bForceReload) = 0;
Loads the script. It is safe to call LoadScript multiple times, only first time the script will be loaded, if bForceReload is not specified.
virtual void Release() = 0;
Destroy IEntityClass object, do not call directly, only EntityRegisty can destroy entity classes.
virtual void SetEditorClassInfo(const SEditorClassInfo& editorClassInfo) = 0;
virtual void SetFlags(uint32 nFlags) = 0;
Set entity class flags.
typedef IEntityProxyPtr (* UserProxyCreateFunc)(IEntity *pEntity, SEntitySpawnParams ¶ms, void *pUserData);
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 ¶ms ) { return new CUserProxy( pEntity,params );