Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Entity

Hierarchy

Index

Constructors

constructor

Properties

Protected _children

_children: Entity[]

Private _eventEmitted

_eventEmitted: boolean

Protected _model

_model: EntityModel

Private _modelCB

_modelCB: function

Type declaration

    • (attribute: string, value: any, oldValue: any): void
    • Parameters

      • attribute: string
      • value: any
      • oldValue: any

      Returns void

Private _modified

_modified: boolean

Private _notifierKeys

_notifierKeys: string[]

Protected _parent

_parent: Entity

Private _parentNotifierKeys

_parentNotifierKeys: string[]

Private _regionDimension

_regionDimension: Dimension

Private _regionList

_regionList: object

Type declaration

Private _regions

_regions: Entity[][][]

collisionable

collisionable: boolean

view

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

ID

  • get ID(): string

color

  • get color(): Color
  • set color(color: Color): void

coordinate

height

  • get height(): number
  • set height(height: number): void

model

parent

regionDimension

regions

texture

  • get texture(): Asset
  • set texture(asset: Asset): void

type

  • get type(): string
  • set type(type: string): void

visible

  • get visible(): boolean
  • set visible(state: boolean): void

width

  • get width(): number
  • set width(width: number): void

x

  • get x(): number
  • set x(x: number): void

x2

  • get x2(): number

y

  • get y(): number
  • set y(y: number): void

y2

  • get y2(): number

z

  • get z(): number
  • set z(z: number): void

Methods

Private _coordinateToRegion

Private _generateRegions

  • _generateRegions(): void
  • private _generateRegions

    Genetates regions of children to make searches more efficient
    

    Returns void

Private _getChildrenInRegion

Private _putChildInRegion

  • _putChildInRegion(child: Entity): void

Private _removeChildFromRegions

  • _removeChildFromRegions(child: Entity): void

Private _setDefaults

  • _setDefaults(): void
  • private _setDefaults

    Sets the default attributes for this entity.
    

    Returns void

Private _setModified

  • _setModified(state: boolean): void
  • private setModified

    Sets whether this Entity has been modified since the last render
    frame.
    

    Parameters

    • state: boolean

    Returns void

Private _updateChildsRegion

  • _updateChildsRegion(child: Entity): void

addChild

  • addChild(child: Entity): void

addListener

  • addListener(event: string | symbol, listener: function): this

childCount

  • childCount(): number
  • public childCount

    Counts the number of child nodes inside this entity.
    

    Returns number

emit

  • emit(event: string | symbol, ...args: any[]): boolean

eventNames

  • eventNames(): Array<string | symbol>

findChildren

findTopChildAt

  • public findTopChildAt

    Tries to find the deepest child at the top most layer at this coordinates. TODO: Update this to support Layers once we have layers...

    Parameters

    Returns Entity | boolean

    Entity

getAbsoluteX

  • getAbsoluteX(): number

getAbsoluteX2

  • getAbsoluteX2(): number

getAbsoluteY

  • getAbsoluteY(): number

getAbsoluteY2

  • getAbsoluteY2(): number

getChildAt

  • getChildAt(index: number): Entity

getChildren

  • public getChildren

    Returns an Iterator of Children.  Can pass
    in a set of coordinates to get children in a specific
    region of coordinates relative to the entity (0,0 is top left of this entity).
    If only the starTCoordinate is specified, looks up children who intersect with that point.
    If both arguements are passed in, looks for children who intersect with the rect the coords create.
    If neither are provided, just returns an iterator of all children.
    

    Not recursive, only checks it's own children

    Parameters

    Returns Iterator

    Iterator

getCoordinate

getLocation

getMaxListeners

  • getMaxListeners(): number

getOuterCoordinate

getSize

indexOf

  • indexOf(child: Entity): number

isChild

  • isChild(child: Entity): boolean
  • public isChild

    Checks to see if the given entity is a child of
    this entity.
    

    Parameters

    Returns boolean

isModified

  • isModified(): boolean
  • public isModified

    Indicates whether this Entity has been modified since the last render frame.
    

    Returns boolean

iterator

  • public iterator DEPRECATED - use getChildren()

    Creates a child node iterator for this entity.
    

    Returns Iterator

    { hasNext : function() next : function() hasPrevious : function() previous : function() }

listenerCount

  • listenerCount(type: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]

on

  • on(event: string | symbol, listener: function): this

once

  • once(event: string | symbol, listener: function): this

prependListener

  • prependListener(event: string | symbol, listener: function): this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this

removeAllChildren

  • removeAllChildren(): void
  • public removeAllChildren

    Removes all child nodes of this entity.
    

    Returns void

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeChild

  • removeChild(child: Entity): void

removeListener

  • removeListener(event: string | symbol, listener: function): this

setLocation

  • public setLocation

    Sets the coordinates of this entity. All arguments are optional.
    

    Parameters

    Returns void

setMaxListeners

  • setMaxListeners(n: number): this

setSize

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number

Generated using TypeDoc