EntityRepresentation:
Filter:
GameLoop/Classes (extension) | Undocumented classes

EntityRepresentation
ExtensionExtension

An abstract class for defining representations
NOTE: Always use detach to remove a representation and not remove.

Description

EntityRepresentation is the base class for all representations. A representation is added as a dependant to an entity using the attach method.

Class Methods

.new

Create an EntityRepresentation.

Arguments:

repManager

an instance of RepresentationManager

collisionFunc

A function to be evaluated when a collision is detected. The function is passed the representation, entity and an array with the colliding entities.

Instance Methods

.detach

Call entity.detach(representation) to remove the relation with the entity and clear.

.preUpdate

Private method to allow for interpolation we can preUpdate the new positions that will be assigned in the next time step (dt).

.addAll

Synchronously add the entity and the representation to the relevant managers.

Arguments:

delay

A delay for the addition of the representation. Typically used for the addition of the entity after the latency used for jitlib NodeProxy instantiation.

.colliding

Returns true or false

.add

Add to the RepresentationManager

.speed

Returns the current speed of the entity.

.attached

Returns true or false

.type

Sound or visual

.getData

Get the data from the entity and store it in the relevant variables.

.update

The method that receives the messages when the entity is changed.

.remove

Always use detach on the entity to remove a representation. Remove the representation from the representation manager. Used internally.