The Entity Component System class.

Hierarchy

  • EntityComponentSystem

Constructors

Properties

components: Component[]

All registered components

Default Value

[]

entities: Entity[]

All registered entities

Default Value

[]

processors: Processor[]

All registered processors

Default Value

[]

Methods

  • Adds a component to the system.

    Parameters

    Returns void

    Void if successful

  • Adds a component to an entity.

    Parameters

    • entity: Entity

      entity object

    • component: string

      Name of component

    Returns void

    Void if operation is successful or throws an error.

  • Adds a entity to the system.

    Parameters

    • entity: Entity

      entity object

    Returns void

    Void if successful

  • Adds a processor to the system.

    Parameters

    Returns void

    Void if successful

  • Adds a processor to an entity.

    Parameters

    • entity: Entity

      entity object

    • processor: string

      Name of processor

    Returns void

    Void if operation is successful or throws an error.

  • Composes a entity with given components.

    Parameters

    • name: string

      Name of the entity

    • components: string[]

      An array of component names

    • processors: string[]

      An array of processor names

    Returns Entity

    The composed entity or throws an error.

  • Checks if an entity has target component.

    Parameters

    • entity: Entity

      entity object

    • component: string

      Name of component

    Returns boolean

    true if entity has the component or false if not

  • Checks if an entity has target processor.

    Parameters

    • entity: Entity

      entity object

    • processor: string

      Name of processor

    Returns boolean

    true if entity has the processor or false if not

  • Gets a registered component by name.

    Parameters

    • name: string

      Name of the component

    Returns Component

    A component or throws an error.

  • Gets all registered entities.

    Returns Entity[]

    All registered entities in an array.

  • Gets all registered entities that match the given name.

    Parameters

    • name: string

      Name of the entity

    Returns Entity[]

    An array of entities or an empty array.

  • Gets all entities that have the target component registered.

    Parameters

    • components: string[]

    Returns Entity[]

    All entities in an array.

  • Gets a registered entity by name.

    Parameters

    • name: string

      Name of the entity

    Returns Entity

    A entity or throws an error.

  • Gets a registered processor by name.

    Parameters

    • name: string

      Name of the processor

    Returns Processor

    A processor or throws an error.

  • Checks if component is registered.

    Parameters

    • name: string

      Name of the component

    Returns boolean

    true if found or false if not.

  • Checks if entity is registered.

    Parameters

    • name: string

      Name of the entity

    Returns boolean

    true if found or false if not.

  • Checks if processor is registered by name.

    Parameters

    • name: string

      Name of the processor

    Returns boolean

    true if found or false if not.

  • Removes all entities from the system.

    Returns void

    void

  • Removes a component from an entity.

    Parameters

    • entity: Entity

      entity object

    • component: string

      Name of component

    Returns void

    Void if operation successful or throw an error.

  • Removes an entity from the system.

    Parameters

    • entity: Entity

      entity object

    Returns void

    Void if successful or throws an error.

  • Removes processor from an entity.

    Parameters

    • entity: Entity

      entity object

    • processor: string

      Name of processor

    Returns void

    Void if operation successful or throws an error.

  • Runs all processors for it's corresponding components e.g. run the prcoessors update function.

    Returns void

    Void if successful

  • Runs all processors. This should be done per frame e.g. inside your gameloop.

    Returns void

    Void if successful

Generated using TypeDoc