Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Engine

classdesc

Core singleton representing an instance of the Aurora engine. The engine is responsible for the creation (and registration) of entities, as well as initialization and running of systems containing game logic.

Hierarchy

  • Engine

Index

Constructors

constructor

Accessors

assemblies

  • description

    Get all of the engine's assemblies.

    readonly

    Returns Entity[]

    • Array of assembly (entity) instances

entities

  • description

    Get all of the engine's entities.

    readonly

    Returns Entity[]

    • Array of entity instances

lastTickTime

  • get lastTickTime(): number
  • description

    Get the timestamp of the engine's last tick.

    readonly

    Returns number

    • Timestamp in milliseconds

onTickComplete

  • get onTickComplete(): Function
  • set onTickComplete(fn: Function): void
  • description

    Get the function currently set to execute after every tick.

    readonly

    Returns Function

    • Function currently set to execute
  • description

    Set a function to execute after every update tick.

    Parameters

    • fn: Function

      Function to execute

    Returns void

    • Function currently set to execute

onTickStart

  • get onTickStart(): Function
  • set onTickStart(fn: Function): void
  • description

    Get the function currently set to execute before every tick.

    readonly

    Returns Function

    • Function currently set to execute
  • description

    Set a function to execute before every update tick.

    Parameters

    • fn: Function

      Function to execute

    Returns void

    • Function currently set to execute

running

  • get running(): boolean
  • description

    Get whether or not the engine is currently running.

    readonly

    Returns boolean

    • True if the engine is running

systems

  • description

    Get all of the engine's systems.

    readonly

    Returns System[]

    • Array of system instances

Methods

addAssembly

  • description

    Add an assembly (entity) instance to the engine.

    Parameters

    • assembly: Entity

      Assembly instance

    Returns Entity[]

    • Array of assembly (entity) instances

addEntity

  • description

    Add an entity instance to the engine. This will check which systems should watch it, and add it to those systems (running the entity through each system's onAdd hook. After being added and initialized, entities are immutable (although their component data is not).

    Parameters

    • entity: Entity

      Entity instance

    Returns Entity[]

    • Array of entity instances

addSystem

  • description

    Add a system instance to the engine. This will run the system's onInit hook. After being added and initialized, systems are immutable and are updated every game tick.

    Parameters

    • system: System

      System instance

    Returns System[]

    • Array of system instances

getAssembly

  • getAssembly(type: string): Entity
  • description

    Get an assembly (entity) instance by type from the engine.

    readonly

    Parameters

    • type: string

      Assembly type

    Returns Entity

    • Requested assembly (entity) instance

getEntity

  • getEntity(uuid: string): Entity
  • description

    Get an entity instance by UUID from the engine.

    readonly

    Parameters

    • uuid: string

      Entity UUID

    Returns Entity

    • Requested entity instance

getSystem

  • getSystem(name: string): System
  • description

    Get a system instance by name from the engine.

    readonly

    Parameters

    • name: string

      System name

    Returns System

    • Requested system instance

hasAssembly

  • hasAssembly(type: string): boolean
  • description

    Check if an assembly is present within the engine.

    readonly

    Parameters

    • type: string

    Returns boolean

    • True if the assembly is present

hasEntity

  • hasEntity(uuid: string): boolean
  • description

    Check if a system is present within the engine.

    readonly

    Parameters

    • uuid: string

    Returns boolean

    • True if the entity is present

hasSystem

  • hasSystem(name: string): boolean
  • description

    Check if a system is present within the engine.

    readonly

    Parameters

    • name: string

      System name

    Returns boolean

    • True if the system is present

start

  • start(): void
  • description

    Start the execution of the update loop.

    Returns void

stop

  • stop(): void
  • description

    Stop the execution of the update loop.

    Returns void

Private tick

  • tick(): void
  • description

    Perform one tick and update all systems.

    Returns void

Generated using TypeDoc