API Docs for:
Show:

Entity Class

This constructor is used internally by the manager to create entities and is public only for the purpouse of type checking.

Constructor

Entity

()

Item Index

Methods

add

(
  • component
)

Adds the specified component to the entity.

Parameters:

  • component Object

    A component object. Every component type should have a unique constructor, since all components are referenced by their constructors.

destroy

()

Destroys the entity, completely removing it from the entity system.

get

(
  • constructor
)

Retrieves the specified component from the entity.

Parameters:

  • constructor Function

    Constructor of the component to be retrieved.

Returns:

The retrived component. If the entity doesn't have the specified component, the value will be undefined or null.

getId

() Number

Returns:

Number: The entity's unique identifier.

has

(
  • constructor
)
Boolean

Checks if the entity has a specified component.

Parameters:

  • constructor Function

    Constructor of the component to be checked.

Returns:

Boolean:

remove

(
  • constructor
)

Removes the specified component from the entity.

Parameters:

  • constructor Function

    Constructor of the component to be removed.