Package com.mygdx.game.Managers
Class EntityManager
- java.lang.Object
-
- com.mygdx.game.Managers.EntityManager
-
public final class EntityManager extends java.lang.ObjectResponsible for Managing the entity and component events. Entity's can be accessed by a String name
-
-
Constructor Summary
Constructors Constructor Description EntityManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddComponent(Component c)Dont call manuallystatic voidaddEntity(Entity e)Dont call manuallystatic voidchangeName(java.lang.String prev, java.lang.String new_)changes the entity's namestatic voidcleanUp()Cleans up all entities and components.static floatgetDeltaTime()gets the time between the last from and the currentstatic EntitygetEntity(java.lang.String name)gets the first entity found with the given namestatic intgetFPS()static voidInitialize()Should only be called once although if it isn't called at all it will be called automaticallystatic voidraiseEvents(ComponentEvent... comps)raises the appropriate events for each entity's component.
-
-
-
Method Detail
-
Initialize
public static void Initialize()
Should only be called once although if it isn't called at all it will be called automatically
-
addComponent
public static void addComponent(Component c)
Dont call manually- Parameters:
c- the comp to add
-
addEntity
public static void addEntity(Entity e)
Dont call manually- Parameters:
e- the entity to add
-
getEntity
public static Entity getEntity(java.lang.String name)
gets the first entity found with the given name- Parameters:
name- name of the entity- Returns:
- the found entity
-
changeName
public static void changeName(java.lang.String prev, java.lang.String new_)changes the entity's name- Parameters:
prev- old namenew_- new name
-
raiseEvents
public static void raiseEvents(ComponentEvent... comps)
raises the appropriate events for each entity's component. then renders after all entities have being processed if render is requested- Parameters:
comps- calls the events left to right
-
cleanUp
public static void cleanUp()
Cleans up all entities and components. Disposes of the primary sprite batch
-
getDeltaTime
public static float getDeltaTime()
gets the time between the last from and the current- Returns:
- 1/FPS
-
getFPS
public static int getFPS()
-
-