Mallet Engine  2
Entity-Component based game engine, written in Java.
 All Classes Namespaces Files Functions Variables
Public Member Functions | Public Attributes
com.linxonline.mallet.entity.Entity Class Reference

List of all members.

Public Member Functions

 Entity ()
 Entity (final String _name)
 Entity (final String _name, final String _family)
void setName (final String _name)
String getName ()
final void setPosition (final float _x, final float _y, final float _z)
final void addToPosition (final float _x, final float _y, final float _z)
final boolean isName (final String _name)
final boolean isFamily (final String _family)
final void addComponent (final Component _component)
final void removeComponent (final Component _component)
final void removeComponents (final ArrayList< Component > _components)
final void update (final float _dt)
final Component getComponentByName (final String _name)
final ArrayList< ComponentgetComponentsByName (final String _name)
final ArrayList< ComponentgetComponentByGroup (final String _group)
final ArrayList< ComponentgetAllComponents ()
final Vector3 getPosition ()
final void destroy ()
boolean writeObject (final SerialiseOutput _output)
boolean readObject (final SerialiseInput _input)
void clear ()

Public Attributes

String name = null
String family = null
Vector3 position = new Vector3( 0.0f, 0.0f, 0.0f )
boolean destroy = false

Detailed Description

Entity is a container class for Componets. By default an Entity should have a unique name, and a global family name. For example an Entity could be named HENCHMAN3, and be in the ENEMY family.

Entity also allows an internal component to send messages to other components, it operates in a similar basis to the EventSystem.

Entity does not have the capabilities to recieve Events from a Game State, this should be done through a component like EventComponent that can then route it through the Component Event System.


Constructor & Destructor Documentation

com.linxonline.mallet.entity.Entity.Entity ( final String  _name,
final String  _family 
)

Member Function Documentation

Add a component to the Entity and set its parent to the Entity The Component should not be owned by another Component, it could get messy!

final void com.linxonline.mallet.entity.Entity.addToPosition ( final float  _x,
final float  _y,
final float  _z 
)

Once clear() is called, the Entity it is pretty much dead, it's lost all of its components and the ComponentEventSystem is nulled out.

Call when you wish the Entity to be decalred dead. An Entity decalred destroyed, will be removed by the Entity System when appropriate.

Returns the ArrayList that contains all the Entity's Components. NOTE: the ArrayList is NOT a copy.

final ArrayList<Component> com.linxonline.mallet.entity.Entity.getComponentByGroup ( final String  _group)

Get the Components that have the same Group name and return them in an ArrayList. NOTE: A new ArrayList is created each time this function is called.

Get a Component with the designated name. If there is more than one component with that name, then it will return the first one it finds.

final ArrayList<Component> com.linxonline.mallet.entity.Entity.getComponentsByName ( final String  _name)

Return all the components with the designated name

Returns the Entiy's current position

final boolean com.linxonline.mallet.entity.Entity.isFamily ( final String  _family)

returns true if _family equals Entity family false if not

final boolean com.linxonline.mallet.entity.Entity.isName ( final String  _name)

returns true if _name equals Entity name false if not

boolean com.linxonline.mallet.entity.Entity.readObject ( final SerialiseInput  _input)

Used to read an Entity byte stream and reconstruct it. It does NOT build the Entity from scratch.

final void com.linxonline.mallet.entity.Entity.removeComponents ( final ArrayList< Component _components)
void com.linxonline.mallet.entity.Entity.setName ( final String  _name)

Once a name has been set it should not be changed. The Entity System may change an Entitys name to ensure it is unique.

final void com.linxonline.mallet.entity.Entity.setPosition ( final float  _x,
final float  _y,
final float  _z 
)
final void com.linxonline.mallet.entity.Entity.update ( final float  _dt)

Update the message system of the Entity and update the Components

boolean com.linxonline.mallet.entity.Entity.writeObject ( final SerialiseOutput  _output)

Used to write out the byte stream of the Entity object


Member Data Documentation

Vector3 com.linxonline.mallet.entity.Entity.position = new Vector3( 0.0f, 0.0f, 0.0f )

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables