Entity Class Reference
#include <Entity.h>
![](../class_entity.png)
# Public Member Functions | |
void | constructor () |
Class' constructor. | |
override bool | handleMessage (Telegram telegram) |
void | clearComponentLists (uint32 componentType) |
Component | addComponent (const ComponentSpec *componentSpec) |
void | removeComponent (Component component) |
void | addComponents (ComponentSpec **componentSpecs, uint32 componentType) |
void | removeComponents (uint32 componentType) |
Component | getComponentAtIndex (uint32 componentType, int16 componentIndex) |
VirtualList | getComponents (uint32 componentType) |
bool | getComponentsOfClass (ClassPointer classPointer, VirtualList components, uint32 componentType) |
uint16 | getComponentsCount (uint32 componentType) |
void | resetComponents () |
Reset components. | |
void | setVisible () |
Set this instance's visibility flag up. | |
const Transformation * | getTransformation () |
const Vector3D * | getPosition () |
const Rotation * | getRotation () |
const Scale * | getScale () |
Body | getBody () |
bool | isMoving () |
void | stopAllMovement () |
Stop all entity's movement. | |
void | stopMovement (uint16 axis) |
bool | setVelocity (const Vector3D *velocity, bool checkIfCanMove) |
const Vector3D * | getVelocity () |
fixed_t | getSpeed () |
fixed_t | getMaximumSpeed () |
fixed_t | getBounciness () |
fixed_t | getFrictionCoefficient () |
void | enableCollisions () |
Enable collision detection on the entity's colliders. | |
void | disableCollisions () |
Disable collision detection on the entity's colliders. | |
void | checkCollisions (bool activate) |
void | registerCollisions (bool activate) |
void | setCollidersLayers (uint32 layers) |
uint32 | getCollidersLayers () |
void | setCollidersLayersToIgnore (uint32 layersToIgnore) |
uint32 | getCollidersLayersToIgnore () |
bool | hasColliders () |
void | showColliders () |
Make the entity's colliders visible. | |
void | hideColliders () |
Make the entity's colliders invisible. | |
virtual void | createComponents (ComponentSpec **componentSpecs) |
virtual void | destroyComponents () |
Destroy the components that attach to this container. | |
virtual void | addedComponent (Component component) |
virtual void | removedComponent (Component component) |
virtual void | show () |
Make this instance visible. | |
virtual void | hide () |
Make this instance invisible. | |
virtual void | setTransparency (uint8 transparency) |
virtual void | calculateSize () |
Configure the entity's size. | |
virtual fixed_t | getRadius () |
virtual void | setPosition (const Vector3D *position) |
virtual void | setRotation (const Rotation *rotation) |
virtual void | setScale (const Scale *scale) |
virtual void | setDirection (const Vector3D *direction) |
virtual const Vector3D * | getDirection () |
virtual bool | applyForce (const Vector3D *force, bool checkIfCanMove) |
virtual bool | canMoveTowards (Vector3D direction) |
virtual bool | isSensibleToCollidingObjectBouncinessOnCollision (Entity collidingEntity) |
virtual bool | isSensibleToCollidingObjectFrictionOnCollision (Entity collidingEntity) |
virtual bool | isSubjectToGravity (Vector3D gravity) |
virtual bool | collisionStarts (const CollisionInformation *collisionInformation) |
virtual void | collisionPersists (const CollisionInformation *collisionInformation) |
virtual void | collisionEnds (const CollisionInformation *collisionInformation) |
virtual uint32 | getInGameType () |
# Protected Attributes | |
VirtualList * | components |
Linked list of attached components. | |
Transformation | transformation |
3D transformation | |
Body | body |
bool | isVisible |
Flag used for streaming purposes. |
# Additional Inherited Members | |
![]() | |
void | constructor () |
Class' constructor. | |
void | destructor () |
Class' destructor. | |
void | addEventListener (ListenerObject listener, uint16 eventCode) |
void | removeEventListener (ListenerObject listener, uint16 eventCode) |
void | removeEventListeners (uint16 eventCode) |
void | removeAllEventListeners () |
Remove all listener objects. | |
bool | hasActiveEventListeners () |
void | fireEvent (uint16 eventCode) |
void | sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay) |
void | sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay) |
void | discardAllMessages () |
Discard all messages, both to be sent and to be received. | |
void | discardMessages (uint32 message) |
virtual bool | onEvent (ListenerObject eventFirer, uint16 eventCode) |
![]() | |
VirtualList | events |
List of registered events. | |
int8 | eventFirings |
Counter that keeps track of the number of fired events to prevent race conditions in nested firings. |
# Detailed Description
# Member Function Documentation
# addComponent()
Component Entity::addComponent | ( | const ComponentSpec * | componentSpec | ) |
# addComponents()
void Entity::addComponents | ( | ComponentSpec ** | componentSpecs, |
uint32 | componentType ) |
# addedComponent()
|
virtual |
# applyForce()
# calculateSize()
|
virtual |
# canMoveTowards()
# checkCollisions()
void Entity::checkCollisions | ( | bool | activate | ) |
# clearComponentLists()
void Entity::clearComponentLists | ( | uint32 | componentType | ) |
# collisionEnds()
|
virtual |
# collisionPersists()
|
virtual |
# collisionStarts()
|
virtual |
Process a newly detected collision by one of the component colliders.
- Parameters
-
collisionInformation Information struct about the collision to resolve
- Returns
- True if the collider must keep track of the collision to detect if it persists and when it ends; false otherwise
Reimplemented in Particle.
# constructor()
# createComponents()
|
virtual |
# destroyComponents()
|
virtual |
# disableCollisions()
void Entity::disableCollisions | ( | ) |
# enableCollisions()
void Entity::enableCollisions | ( | ) |
# getBody()
Body Entity::getBody | ( | ) |
# getBounciness()
fixed_t Entity::getBounciness | ( | ) |
# getCollidersLayers()
uint32 Entity::getCollidersLayers | ( | ) |
# getCollidersLayersToIgnore()
uint32 Entity::getCollidersLayersToIgnore | ( | ) |
# getComponentAtIndex()
# getComponents()
VirtualList Entity::getComponents | ( | uint32 | componentType | ) |
# getComponentsCount()
# getComponentsOfClass()
bool Entity::getComponentsOfClass | ( | ClassPointer | classPointer, |
VirtualList | components, | ||
uint32 | componentType ) |
Retrieve the linked list of components that are instances of the provided class.
- Parameters
-
classPointer Pointer to the class to use as search criteria. Usage: typeofclass(ClassName) components Linked list to be filled with the components that meed the search criteria (it is externally allocated and must be externally deleted) componentType Type of components to retrieve
- Returns
- True if one or more components met the search criteria; false otherwise
# getDirection()
|
virtual |
# getFrictionCoefficient()
fixed_t Entity::getFrictionCoefficient | ( | ) |
# getInGameType()
|
virtual |
# getMaximumSpeed()
fixed_t Entity::getMaximumSpeed | ( | ) |
# getPosition()
const Vector3D * Entity::getPosition | ( | ) |
# getRadius()
|
virtual |
# getRotation()
const Rotation * Entity::getRotation | ( | ) |
# getScale()
const Scale * Entity::getScale | ( | ) |
# getSpeed()
fixed_t Entity::getSpeed | ( | ) |
# getTransformation()
const Transformation * Entity::getTransformation | ( | ) |
# getVelocity()
const Vector3D * Entity::getVelocity | ( | ) |
# handleMessage()
Receive and process a Telegram.
- Parameters
-
telegram Received telegram to process
- Returns
- True if the telegram was processed
Reimplemented from ListenerObject.
# hasColliders()
bool Entity::hasColliders | ( | ) |
Check if the entity has attached colliders.
- Returns
- True if the entity hast at least on collider arrached; false otherwise
# hide()
|
virtual |
Make this instance invisible.
Reimplemented in Container, and ParticleSystem.
# hideColliders()
void Entity::hideColliders | ( | ) |
# isMoving()
bool Entity::isMoving | ( | ) |
# isSensibleToCollidingObjectBouncinessOnCollision()
# isSensibleToCollidingObjectFrictionOnCollision()
# isSubjectToGravity()
# registerCollisions()
void Entity::registerCollisions | ( | bool | activate | ) |
Enable or disable the register of detected collisions.
- Parameters
-
activate If false, this entity's colliders won't keep track of collisions, hence they won't notify of it of persisting (collisionPersists) collisions or when end (collisionEnds)
# removeComponent()
void Entity::removeComponent | ( | Component | component | ) |
# removeComponents()
void Entity::removeComponents | ( | uint32 | componentType | ) |
# removedComponent()
|
virtual |
# resetComponents()
# setCollidersLayers()
void Entity::setCollidersLayers | ( | uint32 | layers | ) |
# setCollidersLayersToIgnore()
void Entity::setCollidersLayersToIgnore | ( | uint32 | layersToIgnore | ) |
# setDirection()
|
virtual |
# setPosition()
|
virtual |
# setRotation()
|
virtual |
# setScale()
|
virtual |
# setTransparency()
|
virtual |
Set this instance's transparency effects.
- Parameters
-
transparency Transparecy effect (__TRANSPARENCY_NONE, __EVEN or __ODD)
Reimplemented in Container, ParticleSystem, and Printer.
# setVelocity()
Set the entity's velocity vector.
- Parameters
-
velocity Velocity vector to assign to the entity's body checkIfCanMove If true, the entity checks that none of its colliders will enter a collision if it were to move in the direction of the provided velocity
- Returns
- True if the entity started to move in the direction specified by the provided velocity vector
# setVisible()
void Entity::setVisible | ( | ) |
# show()
|
virtual |
Make this instance visible.
Reimplemented in Container, and ParticleSystem.
# showColliders()
void Entity::showColliders | ( | ) |
# stopAllMovement()
void Entity::stopAllMovement | ( | ) |
# stopMovement()
void Entity::stopMovement | ( | uint16 | axis | ) |
# Member Data Documentation
# body
|
protected |
Cache the Body component for physics simulations to avoid having constantly grabing it from the ComponentManager
# components
|
protected |
# isVisible
|
protected |
# transformation
|
protected |
The documentation for this class was generated from the following files: