Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Entity

Hierarchy

Index

Constructors

constructor

Properties

children

children: Entity[] = []

id

id: string

name

name: string

Optional parent

parent: Entity

Optional prefabId

prefabId: undefined | string

Optional templatePath

templatePath: undefined | string

transient

transient: boolean = false

Accessors

active

  • get active(): boolean
  • set active(active: boolean): void

transform

Methods

addChild

  • addChild(c: Entity, preserveWorldPosition?: boolean): this

clearComponent

copy

  • copy(oldIdToNewId?: undefined | __type, persistent?: undefined | false | true): Entity

deserialize

destroy

  • destroy(): void

filterChildren

  • filterChildren(filter: function): Entity[]

findChild

  • findChild(name: string): Entity | undefined

getAncestor

  • getAncestor(typeName: string): Component | null

getAncestorOfType

getComponent

getComponentByName

  • getComponentByName(name: string): null | Component

getComponents

getOrSetComponent

getOrSetComponentByName

  • getOrSetComponentByName(name: string): Component

hasComponent

hasComponentByName

  • hasComponentByName(typeName: string): boolean

hasTag

  • hasTag(tag: string): boolean

insertChild

  • insertChild(c: Entity, index: number, preserveWorldPosition?: boolean): this

isA

  • isA<T>(type: object): boolean

isAncestor

  • isAncestor(potentialAncestor: Entity): boolean

isLoaded

  • isLoaded(): boolean

iterateComponents

  • iterateComponents(handler: function): void

removeAllChildren

  • removeAllChildren(): this

removeChild

  • removeChild(c: Entity): this

serialize

  • serialize(): object

setComponent

  • setComponent<T>(ctor: object, props?: ObjectProps<T>): this

setComponentByName

setProperty

  • setProperty(name: string, value: any): void

setState

setTag

  • setTag(tag: string): this

traverse

  • traverse(handler: function, includeSelf?: boolean): void
  • Parameters

    • handler: function
    • Default value includeSelf: boolean = false

    Returns void

traverseAncestors

  • traverseAncestors(handler: function, includeSelf?: boolean): void
  • Parameters

    • handler: function
    • Default value includeSelf: boolean = false

    Returns void

updateComponent

updateComponentByName

upgrade