Options
All
  • Public
  • Public/Protected
  • All
Menu

Class World<EntityType>

The World is the root of the ECS.

Type parameters

Hierarchy

  • World

Index

Constructors

constructor

  • new World<EntityType>(options?: WorldOptions): World<EntityType>
  • Create a new World.

    Type parameters

    Parameters

    • Optional options: WorldOptions

    Returns World<EntityType>

Properties

enabled

enabled: boolean

Whether the world tick should execute.

Methods

createEntity

  • createEntity(name?: string): EntityType
  • Create a new entity

    Parameters

    • Optional name: string

    Returns EntityType

execute

  • execute(delta?: number, time?: number): void
  • Update the systems per frame.

    Parameters

    • Optional delta: number

      Delta time since the last call

    • Optional time: number

      Elapsed time

    Returns void

getSystem

  • getSystem<S>(System: SystemConstructor<S>): S
  • Get a system registered in this world.

    Type parameters

    Parameters

    • System: SystemConstructor<S>

      Type of system to get.

    Returns S

getSystems

  • getSystems(): System<Entity>[]
  • Get a list of systems registered in this world.

    Returns System<Entity>[]

hasRegisteredComponent

  • Evluate whether a component has been registered to this world or not.

    Type parameters

    Parameters

    Returns boolean

play

  • play(): void
  • Resume execution of this world.

    Returns void

registerComponent

  • Register a component.

    Type parameters

    Parameters

    Returns World<EntityType>

registerSystem

  • registerSystem(System: SystemConstructor<any>, attributes?: object): World<EntityType>
  • Register a system.

    Parameters

    • System: SystemConstructor<any>

      Type of system to register

    • Optional attributes: object

    Returns World<EntityType>

stop

  • stop(): void
  • Stop execution of this world.

    Returns void

unregisterSystem

  • unregisterSystem(System: SystemConstructor<any>): World<EntityType>
  • Unregister a system.

    Parameters

    • System: SystemConstructor<any>

      Type of system to unregister

    Returns World<EntityType>

Generated using TypeDoc