Entity Class
Game Framework is deprecated and no longer supported. We can't guarantee the stable work of the framework.
The base class for a custom entity. This class provides the quick access to the node.
The Entity class implementation can be found in the data/framework/game/entity.h file.
Entity Class
Members
void setEnabled(int mode)
Toggles an entity and an associated node reference. The setter attribute is [set_toggle: Enabled].Arguments
- int mode - 1 to enable an entity and a node reference; 0 to disable.
int isEnabled()
Returns a value indicating if an entity is enabled. The getter attribute is [get_toggle: Enabled].Return value
1 if an entity is enabled; otherwise 0.void setFlushable(int mode)
Toggles the onFlush() function call. The setter attribute is [set_toggle: Flushable].Arguments
- int mode - 1 to enable the onFlush() function call; 0 to disable.
int isFlushable()
Returns a value indicating if the onFlush() function is called. The getter attribute is [get_toggle: Flushable].Return value
1 if the onFlush() function is called; otherwise 0.Game getGame()
Returns the current game.Return value
Current game.Level getLevel()
Returns the current level.Return value
Current Level.string getName()
Returns an entity name.Return value
Entity name.Node getNode()
Returns the node associated with the entity.Return value
Node; if the node is not found, returns NULL.Node getNode(string name)
Returns the first occurrence of a node in node reference (or other node) children.Arguments
- string name - Node name.
Return value
Node; if the node is not found, returns NULL.NodeReference getNodeReference()
Returns a node reference associated with an entity (if a node associated with the entity is not a node reference, an assert will be returned).Return value
Node reference.void setPosition(Vec3 pos)
Sets a node reference position.Arguments
- Vec3 pos - Position coordinates of the node reference.
Vec3 getPosition()
Returns a node reference position.Return value
Position coordinates of the node reference.void setRenderable(int mode)
Toggles the onRender() function call. The setter attribute is [set_toggle: Renderable].Arguments
- int mode - 1 to enable the onRender() function call; 0 to disable.
int isRenderable()
Returns a value indicating if onRender() function is called. The getter attribute is [get_toggle: Renderable].Return value
1 if the onRender() is called; otherwise 0.Node getRootNode()
Returns a root node of a node reference, associated with an entity (if a node associated with the entity is not a node reference, an assert will be returned).Return value
Root node.void setRotation(quat q)
Sets the node reference rotation.Arguments
- quat q - Node reference rotation in the local space.
quat getRotation()
Returns the node reference rotation.Return value
Node reference rotation in the local space.void setTransform(Mat4 t)
Sets the transformation matrix for the node reference.Arguments
- Mat4 t - Transformation matrix.
Mat4 getTransform()
Returns the node reference transformation matrix.Return value
Transformation matrix.void setUpdateable(int mode)
Toggles the onUpdate() function call. The setter attribute is [set_toggle: Updateable].Arguments
- int mode - 1 to enable the onUpdate() function call; 0 to disable.
int isUpdateable()
Returns a value indicating if the onUpdate() function is called. The getter attribute is [get_toggle: Updateable].Return value
1 if the onUpdate() function is called; otherwise 0.void setUpdateOrder(int order)
Sets an entity update order. The setter attribute is [set_switch: Update order].Arguments
- int order - Update order. It can take on the values from 0 to 16. The default is 8.
int getUpdateOrder()
Returns an update order value. The getter attribute is [get_switch: Update order:"-8,-7,-6,-5,-4,-3,-2,-1,default,+1,+2,+3,+4,+5,+6,+7,+8":8].Return value
Update order. The value can be from 0 to 16.Entity()
Constructor. Creates a new Entity class instance.void init(string name, Level level, NodeReference ref)
Initializes an entity and binds it to a node reference.Arguments
- string name - Entity name.
- Level level - Level, to which an entity belongs to.
- NodeReference ref - Node reference.
void onFlush()
Virtual method, which is called on each flush(). It is empty by default. The custom logic of the entity can be implemented here. Also this method can be disabled if necessary.void onInit()
Virtual method, which is called after entity initialization. This method is empty by default. The custom logic of the entity can be implemented here.void onRender()
Virtual method, which is called on each render(). It is empty by default. The custom logic of the entity can be implemented here. Also this method can be disabled if necessary.void onShutdown()
Virtual method, which is called after shutdown(). This method is empty by default. The custom logic of the entity can be implemented here.void onUpdate()
Virtual method, which is called on each update().It is empty by default. The custom logic of the entity can be implemented here. Also this method can be disabled if necessary.void shutdown()
Releases entity resources.Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)