| Modifier and Type | Field and Description |
|---|---|
protected List<Entity> |
entities
List of entities in the world.
|
| Constructor and Description |
|---|
EntityWorld()
Constructs the world with initial entity capacity = 32.
|
EntityWorld(int initialCapacity)
Constructs the world with given initial entity capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEntities(Entity... entitiesToAdd) |
void |
addEntity(Entity entity)
Adds entity to this world.
|
void |
addWorldListener(EntityWorldListener listener)
Add world listener to be notified of events.
|
List<Entity> |
getEntities() |
Array<Entity> |
getEntitiesByComponent(Class<? extends Component> type) |
List<Entity> |
getEntitiesCopy()
Returns entities currently registered in the world.
|
void |
removeEntities(Entity... entitiesToRemove) |
void |
removeEntity(Entity entity) |
void |
removeWorldListener(EntityWorldListener listener)
Remove world listener.
|
protected void |
reset()
Resets the world to its initial state.
|
protected void |
update(double tpf)
Performs a single world update tick.
|
public EntityWorld()
public EntityWorld(int initialCapacity)
initialCapacity - initial entity capacitypublic final void addEntity(Entity entity)
entity - the entity to add to worldpublic final void addEntities(Entity... entitiesToAdd)
entitiesToAdd - the entities to add to worldpublic final void removeEntity(Entity entity)
entity - the entity to remove from worldpublic final void removeEntities(Entity... entitiesToRemove)
entitiesToRemove - the entity to remove from worldprotected void update(double tpf)
tpf - time per frameprotected void reset()
public final void addWorldListener(EntityWorldListener listener)
listener - the listenerpublic final void removeWorldListener(EntityWorldListener listener)
listener - the listenerpublic final List<Entity> getEntities()
public final List<Entity> getEntitiesCopy()
Copyright © 2017. All rights reserved.