Class: Group

Group

new entitas.Group(matcher)

Name Type Description
matcher

Members

countnumber

Count the number of entities in this group

matcherentitas.IMatcher

Get the Matcher for this group

onEntityAddedentitas.utils.ISignal

Subscribe to Entity Addded events

onEntityRemovedentitas.utils.ISignal

Subscribe to Entity Removed events

onEntityUpdatedentitas.utils.ISignal

Subscribe to Entity Updated events

Methods

addEntity(entity, index, component)

Add entity and raise events

Name Type Description
entity
index
component

addEntitySilently(entity)

Add entity without raising events

Name Type Description
entity

containsEntity(entity)

Check if group has this entity

Name Type Description
entity
Returns:
boolean

createObserver(eventType)

Create an Observer for the event type on this group

Name Type Description
eventType

getEntities()

Get a list of the entities in this group

Returns:
Array

getSingleEntity()

Gets an entity singleton.
If a group has more than 1 entity, this is an error condition.

Returns:
entitas.Entity

handleEntity(entity, index, component)

Handle adding and removing component from the entity and raisieevents

Name Type Description
entity
index
component

handleEntitySilently(entity)

Handle adding and removing component from the entity without raising events

Name Type Description
entity

removeEntity(entity, index, component)

Remove entity and raise events

Name Type Description
entity
index
component

removeEntitySilently(entity)

Remove entity without raising events

Name Type Description
entity

toString()

Create a string representation for this group:

ex: 'Group(Position)'

Returns:
string

updateEntity(entity, index, previousComponent, newComponent)

Update entity and raise events

Name Type Description
entity
index
previousComponent
newComponent