The basic game object. Everything is an entity with components that
are added / removed as needed.
Name | Type | Description |
---|---|---|
componentsEnum |
Object | |
totalComponents |
number |
Members
-
creationIndexnumber
-
A unique sequential index number assigned to each entity at creation
-
idstring
-
Entity Id
-
instanceIndexnumber
-
Instance index
-
namestring
-
Entity name
-
onComponentAddedentitas.ISignal
-
Subscribe to Component Added Event
-
onComponentRemovedentitas.ISignal
-
Subscribe to Component Removed Event
-
onComponentReplacedentitas.ISignal
-
Subscribe to Component Replaced Event
-
onEntityReleasedentitas.ISignal
-
Subscribe to Entity Released Event
Methods
-
addComponent(index, component){entitas.Entity}
-
AddComponent
Name Type Description index
number component
entitas.IComponent Returns:
Type Description entitas.Entity -
addRef(){entitas.Entity}
-
AddRef
Returns:
Type Description entitas.Entity -
Destroy
-
GetComponent
Name Type Description index
number component
entitas.IComponent -
GetComponentIndices
Returns:
Type Description Array.<number> -
GetComponents
Returns:
Type Description Array.<entitas.IComponent> -
HasAnyComponent
Name Type Description indices
Array.<number> Returns:
Type Description boolean -
HasComponent
Name Type Description index
number Returns:
Type Description boolean -
HasComponents
Name Type Description indices
Array.<number> Returns:
Type Description boolean -
Initialize
allocate the entity pool.Name Type Description totalComponents
number Returns:
Type Description Array.<entitas.IComponent> -
Release
-
RemoveAllComponents
-
removeComponent(index){entitas.Entity}
-
RemoveComponent
Name Type Description index
number Returns:
Type Description entitas.Entity -
replaceComponent(index, component){entitas.Entity}
-
ReplaceComponent
Name Type Description index
number component
entitas.IComponent Returns:
Type Description entitas.Entity -
ToString
Returns:
Type Description string