Adds a component to the entity
The Entity to which the component will be added
The class of the component
The instance of the component
Adds an instance of a component to an entity
The Entity to which the component will be added
The instance of the component
The instance of the component
Creates multiple entities based on an array of component collections
An array of collections of component instances and component classes
An array with the created entities, in the same order of the collections of components
Creates an entity without component
The created Entity
Creates an Entity based on a collection of Component instances and ComponentTypes
A collection of component instances and component classes
The created Entity
Disables a component instance
The component instance
Disables a component by its entity and type
The target entity
The component class
Disable all Entities that have a component of the given type
The class of the component
Enables a component instance
The component instance
Enables a component by its entity and type
The target entity
The component class
Enable all Entities that have a component of the given type
The class of the component
Searches for and returns an entity for the component instance
The component instance
The found Entity
Returns TRUE if the Entity has a component of the given type, otherwise it returns FALSE.
The entity to verify
The class of the component
boolean
Returns TRUE if the component is enabled, otherwise it returns FALSE
The component instance
boolean
Returns TRUE if the component is enabled, otherwise it returns FALSE
The target entity
The component class
boolean
Removes the component instance from its Entity
The component instance
Removes a component from the entity according to the given type
The target entity
The component class
Performs a search for entities given a component type.
This method returns a collection of objects of type SearchResult, which has the entity found, and the instance of the component.
This search can be filtered by passing as a second argument an instance of SearchCriteria, which performs a match between the attributes of the component and the given value.
The third argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
The component class
Optional
criteria: SearchCriteriaThe search criteria
TRUE to incluide disabled entities and components, FALSE otherwise
SearchResult
const searchResult = entityManager.search(SpriteRenderer);
searchResult.forEach(({component, entity}) => {
// do something with the component and entity
})
const searchResult = entityManager.search(Enemy, {status: "alive"});
searchResult.forEach(({component, entity}) => {
// do something with the component and entity
})
Performs an entity search given a collection of component types.
The entities found must have an instance of all the given component types.
This method returns a collection of Entities.
A collection of component classes
A collection of entities
The EntityManager manages the entities and components.
It provides the necessary methods for reading and writing entities and components.