Entity Class
This constructor is used internally by the manager to create entities and is public only for the purpouse of type checking.
Constructor
Entity
()
Methods
add
(
-
component
Adds the specified component to the entity.
Parameters:
-
component
ObjectA component object. Every component type should have a unique constructor, since all components are referenced by their constructors.
destroy
()
Destroys the entity, completely removing it from the entity system.
get
(
-
constructor
Retrieves the specified component from the entity.
Parameters:
-
constructor
FunctionConstructor of the component to be retrieved.
Returns:
The retrived component. If the entity doesn't have the specified component, the value will be undefined or null.
getId
()
Number
Returns:
Number:
The entity's unique identifier.
has
(
Boolean
-
constructor
Checks if the entity has a specified component.
Parameters:
-
constructor
FunctionConstructor of the component to be checked.
Returns:
Boolean:
remove
(
-
constructor
Removes the specified component from the entity.
Parameters:
-
constructor
FunctionConstructor of the component to be removed.