dot big bang

Developer API
Menu

Class EntityRef<T>

All
  • Public
  • Public/Protected
  • All

Type parameters

Hierarchy

  • EntityRef

Index

Constructors

Accessors

Methods

Constructors

constructor

Accessors

id

  • get id(): string
  • Returns the id of the Entity this EntityRef points to. If this EntityRef is not set to anything, the id is the empty string

    Returns string

Methods

clone

  • Returns a new EntityRef object that's a copy of this one. Note that what gets cloned here is just the EntityRef object (i.e. the indirection to an Entity). The underlying Entity, if any, isn't duplicated/cloned.

    Returns EntityRef<T>

copy

exists

  • Returns true if this EntityRef points to an Entity that exists in the Game. Return false if this EntityRef is empty or if the Entity it points to isn't in the Game

    Returns this is EntityRef<Entity>

get

  • get(): T
  • Returns the Entity pointed to by this EntityRef or null if the Entity isn't in the Game anymore.

    Returns T

set

  • set(entity: null | Entity): void
  • Sets this EntityRef to point to the provided Entity. If it is set to null, this EntityRef is cleared and won't point to anything. If the given Entity doesn't belong to the Game, this EntityRef will return null when get() is called until the Entity is back into the Game.

    Parameters

    Returns void