Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EntityPool

Hierarchy

  • EntityPool

Constructors

constructor

Properties

Private generations

generations: Array<number> = []

Array with the generation of all avabile entities.

Private indexMask

indexMask: number

Bitmask for getting the index from an entity id.

Private options

options: Readonly<EntityPoolOptions>

The final set of options to be used by the ecs

Private recycleDeque

recycleDeque: Deque<number>

Deque with all the entities ready to be reused.

Methods

alive

  • alive(id: number): boolean
  • Gets the state of an entity (alive / dead).

    Parameters

    • id: number

      The id of the entity.

    Returns boolean

create

  • create(allowRecycling?: boolean): number
  • Generates a new entity id.

    Parameters

    • Default value allowRecycling: boolean = true

      Allows recycling entities.

    Returns number

destroy

  • destroy(id: number): void
  • Destroys an entity and flags it for recycling.

    Parameters

    • id: number

      The id of the entity

    Returns void

Generated using TypeDoc