Class: Pool

Pool

new entitas.Pool(components, totalComponents, startCreationIndex)

Name Type Description
components Object
totalComponents number
startCreationIndex number

Members

countnumber

Count of active entities

namestring

Entity name for debugging

onEntityCreatedentitas.utils.ISignal

Subscribe to Entity Created Event

onEntityDestroyedentitas.utils.ISignal

Subscribe to Entity Destroyed Event

onEntityWillBeDestroyedentitas.utils.ISignal

Subscribe to Entity Will Be Destroyed Event

onGroupCreatedentitas.utils.ISignal

Subscribe to Group Created Event

retainedEntitiesCountnumber

Count of entities that sill have references

reusableEntitiesCountnumber

Count of entities waiting to be recycled

subsystementitas.IReactiveExecuteSystem

Get subsystems

totalComponentsnumber

The total number of components in this pool

Methods

createEntity(name){entitas.Entity}

Create a new entity

Name Type Description
name string
Returns:
Type Description
entitas.Entity

createSystem(system){entitas.ISystem}

Create System

Name Type Description
system entitas.ISystem | function
Returns:
Type Description
entitas.ISystem

destroyAllEntities()

Destroy All Entities

destroyEntity(entity)

Destroy an entity

Name Type Description
entity entitas.Entity

getEntities(){Array.<entitas.Entity>}

Gets all of the entities

Returns:
Type Description
Array.<entitas.Entity>

getGroup(matcher){entitas.Group}

Gets all of the entities that match

Name Type Description
matcher entias.IMatcher
Returns:
Type Description
entitas.Group

hasEntity(entity){boolean}

Check if pool has this entity

Name Type Description
entity entitas.Entity
Returns:
Type Description
boolean

onEntityReleased(entity)

Name Type Description
entity entitas.Entity

updateGroupsComponentAddedOrRemoved(entity, index, component)

Name Type Description
entity entitas.Entity
index number
component entitas.IComponent

updateGroupsComponentReplaced(entity, index, previousComponent, newComponent)

Name Type Description
entity entitas.Entity
index number
previousComponent entitas.IComponent
newComponent entitas.IComponent