Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Registry

The central object of the ECS system.

Hierarchy

  • Registry

Index

Constructors

Properties

cCounter: number
components: Map<symbol, { defVal: object; map: Map<symbol, object>; name: string }>
eCounter: number
entities: Map<symbol, { compList: symbol[] }>
selectedEntity: symbol

Methods

  • addComponent(comp: string | symbol): Registry
  • addComponent(comp: string | symbol, values: any): Registry
  • Add a component to the selected entity.

    Parameters

    • comp: string | symbol

    Returns Registry

  • Parameters

    • comp: string | symbol
    • values: any

    Returns Registry

  • componentByName(name: string): symbol
  • Return a component from its name.

    Parameters

    • name: string

    Returns symbol

  • Create and select an entity.

    Returns Registry

  • Parameters

    • name: any

    Returns Registry

  • entityByName(ent: string): symbol
  • Return an entity from its name.

    Parameters

    • ent: string

    Returns symbol

  • entityData(): any
  • entityData(ent: symbol): any
  • Return all data of a given entity

    Returns any

  • Parameters

    • ent: symbol

    Returns any

  • makeComponent(name: string): symbol
  • makeComponent(name: string, defVal: object): symbol
  • Create a new component.

    Parameters

    • name: string

    Returns symbol

  • Parameters

    • name: string
    • defVal: object

    Returns symbol

  • queryAll(callback: ((...compVals: any[]) => void), ...comps: symbol[]): Registry
  • Map callback to all entities that have every components in comps. When callback is called, the corresponding entity is selected.

    Parameters

    • callback: ((...compVals: any[]) => void)
        • (...compVals: any[]): void
        • Parameters

          • Rest ...compVals: any[]

          Returns void

    • Rest ...comps: symbol[]

    Returns Registry

Generated using TypeDoc