classdesc

  Class representing a system.

### Hierarchy

- System

## Index

### Constructors

- constructor

### Accessors

- accumulator
- fixed
- name
- step
- watchedComponentTypes
- watchedEntityUUIDs

### Methods

- addMethod
- canWatch
- dispatch
- init
- isWatchingComponentType
- isWatchingEntity
- removeMethod
- unwatchComponentType
- unwatchEntity
- update
- watchComponentType
- watchEntity

## Constructors

### constructor

- new System(config: SystemConfig): System

- - Defined in core/System.ts:25
  description

    Create a System.

  #### Parameters

  - ##### config: SystemConfig

    Configuration object

  #### Returns System

## Accessors

### accumulator

- get accumulator(): number

- - Defined in core/System.ts:87
  description

    Get the accumulated time of the system.

  readonly

  #### Returns number

  - Time in milliseconds

### fixed

- get fixed(): boolean

- - Defined in core/System.ts:96
  description

    Get whether or not the system uses a fixed step.

  readonly

  #### Returns boolean

  - True if the system uses a fixed step

### name

- get name(): string

- - Defined in core/System.ts:114
  description

    Get the entity's name.

  readonly

  #### Returns string

  - Name string

### step

- get step(): number

- - Defined in core/System.ts:105
  description

    Get the step size of the system in milliseconds.

  readonly

  #### Returns number

  - Time in milliseconds

### watchedComponentTypes

- get watchedComponentTypes(): string[]

- - Defined in core/System.ts:123
  description

    Get all of the component types the system is watching.

  readonly

  #### Returns string[]

  - Array of component types

### watchedEntityUUIDs

- get watchedEntityUUIDs(): string[]

- - Defined in core/System.ts:132
  description

    Get all of the entity UUIDs the system is watching.

  readonly

  #### Returns string[]

  - Array of UUID strings

## Methods

### addMethod

- addMethod(key: string, fn: Function): void

- - Defined in core/System.ts:141
  description

    Add an extra method to the system. Cannot be modified after the system is registered with the engine.

  #### Parameters

  - ##### key: string

    Method identifier

  - ##### fn: Function

    Method to be called by user in the future

  #### Returns void

### canWatch

- canWatch(entity: Entity): boolean

- - Defined in core/System.ts:152
  description

    Check if the system can watch a given entity.

  readonly

  #### Parameters

  - ##### entity: Entity

    Entity to check

  #### Returns boolean

  - True if the given entity is watchable

### dispatch

- dispatch(key: string, payload?: any): any

- - Defined in core/System.ts:172
  description

    Call a user-added method from outside the system. Cannot be modified after the system is registered with the engine.

  #### Parameters

  - ##### key: string

    Method identifier

  - ##### Optional payload: any

    Any data which should be passed to the method

  #### Returns any

  - Any data which the method returns

### init

- init(engine: Engine): void

- - Defined in core/System.ts:184
  description

    Initialize the system (as a part of linking to the engine). After linking the engine, the system will run its stored init hook method. Cannot be modified after the system is registered with the engine.

  #### Parameters

  - ##### engine: Engine

    Engine instance to link to

  #### Returns void

### isWatchingComponentType

- isWatchingComponentType(componentType: string): boolean

- - Defined in core/System.ts:203
  description

    Check if the system is watching a given component type.

  readonly

  #### Parameters

  - ##### componentType: string

  #### Returns boolean

  - True if the given component type is being watched

### isWatchingEntity

- isWatchingEntity(entity: Entity): boolean

- - Defined in core/System.ts:216
  description

    Check if the system is watching a given entity.

  readonly

  #### Parameters

  - ##### entity: Entity

    Entity instance to check

  #### Returns boolean

  - True if the given entity instance is being watched

### removeMethod

- removeMethod(key: string): void

- - Defined in core/System.ts:228
  description

    Remove a user-added method from the system. Cannot be modified after the system is registered with the engine.

  #### Parameters

  - ##### key: string

    Method identifier

  #### Returns void

### unwatchComponentType

- unwatchComponentType(componentType: string): string[]

- - Defined in core/System.ts:241
  description

    Remove a component type to the system's watch list. Cannot be modified after the system is registered with the engine.

  #### Parameters

  - ##### componentType: string

    Component type to stop watching

  #### Returns string[]

  - Array of watched component types

### unwatchEntity

- unwatchEntity(entity: Entity): string[]

- - Defined in core/System.ts:258
  description

    Remove an entity UUID to the system's watch list.

  #### Parameters

  - ##### entity: Entity

    Entity instance to stop watching

  #### Returns string[]

  - Array of watched entity UUIDs

### update

- update(delta: number): void

- - Defined in core/System.ts:273
  description

    Update the system with a given amount of time to simulate. The system will run its stored update function using either a fixed step or variable step (specified at creation) and the supplied delta time. Cannot be modified after the system is registered with the engine.

  #### Parameters

  - ##### delta: number

    Time in milliseconds to simulate

  #### Returns void

### watchComponentType

- watchComponentType(componentType: string): string[]

- - Defined in core/System.ts:292
  description

    Add a single component type to the system's watch list. Cannot be modified after the system is registered with the engine.

  #### Parameters

  - ##### componentType: string

    Component type to watch

  #### Returns string[]

  - Array of watched component types

### watchEntity

- watchEntity(entity: Entity): string[]

- - Defined in core/System.ts:316
  description

    Watch an entity by adding its UUID to to the system. After adding, the system will run the entity through the internal add function to do any additional processing.

  #### Parameters

  - ##### entity: Entity

    Entity instance to watch

  #### Returns string[]

  - Array of watched entity UUIDs

Generated using TypeDoc