Skip to main content

PauseComponent

Marks an entity as pausable and tracks whether it is currently paused.

When a scene is paused the PauseSystem adds the PauseComponentTag to every entity with canPause: true, and the systems that skip that tag (motion, collision, actions, ...) stop updating it.

Most code should use Actor.canPause and Actor.isPaused instead of using this component directly.

Hierarchy

Index

Constructors

constructor

Properties

publiccanPause

canPause: boolean = true

Set to false to keep updating this entity while the scene is paused (for example menus or a HUD), default true

optionalreadonlyinheriteddependencies

dependencies?: ComponentCtor<Component>[]

Optionally list any component types this component depends on If the owner entity does not have these components, new components will be added to the entity

Only components with zero-arg constructors are supported as automatic component dependencies

inheritedowner

owner: Entity<any> | null = null

Current owning Entity, if any, of this component. Null if not added to any Entity

Accessors

publicisPaused

  • get isPaused(): boolean
  • True while the owning scene is paused and this entity can be paused. Managed by the engine, read-only.


    Returns boolean

Methods

inheritedclone

  • Clones any properties on this component, if that property value has a clone() method it will be called


    Returns Component

inheriteddeserialize

  • deserialize(data: Record<string, any>): void
  • Parameters

    • data: Record<string, any>

    Returns void

optionalinheritedonAdd

  • Optional callback called when a component is added to an entity


    Parameters

    Returns void

optionalinheritedonRemove

  • onRemove(previousOwner: Entity): void
  • Optional callback called when a component is removed from an entity


    Parameters

    Returns void

inheritedserialize

  • serialize(): Record<string, any>
  • Returns Record<string, any>

inheritedtoJSON

  • toJSON(pretty?: boolean): string
  • Parameters

    • pretty: boolean = false

    Returns string