Bandidos
Public Member Functions | Static Public Member Functions | List of all members
com.mygdx.game.engine.entities.EntitySystem Class Reference
Inheritance diagram for com.mygdx.game.engine.entities.EntitySystem:
com.mygdx.game.engine.events.IEventReceiver

Public Member Functions

 EntitySystem ()
 
void updateEntities (float dt)
 
void renderEntities (RenderComponents gameRenderComponents)
 
void destroyAllEntities ()
 
void destroyAllEntitiesImmediately ()
 
boolean isEntityInDestroyStack (BaseEntity entity)
 
void destroyEntity (BaseEntity entity)
 
void destroyEntityImmediately (BaseEntity entity)
 
void onReceiveEvent (Event event)
 
ArrayList< BaseEntitygetAllEntities ()
 
BaseEntity getEntityByTag (String tag)
 
BaseEntity [] getEntitiesByTag (String tag)
 

Static Public Member Functions

static EntitySystem getInstance ()
 

Detailed Description

This is a singleton class which handles all the entity handling. By its instance you can find active entities by tags and types. IMPORTANT: This class must be updated in order for all the entities to update and their components.

Author
Ramses Di Perna

Constructor & Destructor Documentation

◆ EntitySystem()

com.mygdx.game.engine.entities.EntitySystem.EntitySystem ( )

Member Function Documentation

◆ destroyAllEntities()

void com.mygdx.game.engine.entities.EntitySystem.destroyAllEntities ( )

Destroys all currently active entities.

◆ destroyAllEntitiesImmediately()

void com.mygdx.game.engine.entities.EntitySystem.destroyAllEntitiesImmediately ( )

Destroys all currently active entities this exact frame.

◆ destroyEntity()

void com.mygdx.game.engine.entities.EntitySystem.destroyEntity ( BaseEntity  entity)

Destroys the given entity.

Parameters
entityto destroy

◆ destroyEntityImmediately()

void com.mygdx.game.engine.entities.EntitySystem.destroyEntityImmediately ( BaseEntity  entity)

Destroys the given entity this exact frame.

◆ getAllEntities()

ArrayList<BaseEntity> com.mygdx.game.engine.entities.EntitySystem.getAllEntities ( )

Gets and returns all the existing entities

Returns
All the entities in the '_allEntities' ArrayList

◆ getEntitiesByTag()

BaseEntity [] com.mygdx.game.engine.entities.EntitySystem.getEntitiesByTag ( String  tag)

Returns all entities active with the given tag

Parameters
tagwhich all the returning entities must have
Returns
all the entities with the given tag

◆ getEntityByTag()

BaseEntity com.mygdx.game.engine.entities.EntitySystem.getEntityByTag ( String  tag)

Returns the first entity active with the given tag

Parameters
tagwhich the entity must have
Returns
the entity with the given tag

◆ getInstance()

static EntitySystem com.mygdx.game.engine.entities.EntitySystem.getInstance ( )
static

◆ isEntityInDestroyStack()

boolean com.mygdx.game.engine.entities.EntitySystem.isEntityInDestroyStack ( BaseEntity  entity)

Checks of the entity is ready for destruction next frame.

Parameters
entityto check if its ready for destruction next frame.
Returns
whether the entity is in the destroyStack.

◆ onReceiveEvent()

void com.mygdx.game.engine.entities.EntitySystem.onReceiveEvent ( Event  event)

This will be triggered when an event has been fired of type which this implementing class was listening to.

Parameters
eventwhich has one of the event types which is listened to.

Implements com.mygdx.game.engine.events.IEventReceiver.

◆ renderEntities()

void com.mygdx.game.engine.entities.EntitySystem.renderEntities ( RenderComponents  gameRenderComponents)

MUST BE CALLED TO RENDER ALL ENTITIES Renders all the entities with the 'RenderComponent' which are active.

Parameters
gameRenderComponentswhich are used to render the entity

◆ updateEntities()

void com.mygdx.game.engine.entities.EntitySystem.updateEntities ( float  dt)

MUST BE CALLED TO UPDATE ALL ENTITIES Without this being called in the loop the system does not work.

Parameters
dtis the delta time between this frame and the last.

The documentation for this class was generated from the following file: