use of com.gemserk.commons.artemis.components.AliveComponent in project commons-gdx by gemserk.
the class AliveSystem method processEntities.
@Override
protected void processEntities() {
RandomAccessMap<Entity, EntityComponents> allTheEntityComponents = factory.entityComponents;
int entitiesSize = allTheEntityComponents.size();
for (int entityIndex = 0; entityIndex < entitiesSize; entityIndex++) {
EntityComponents entityComponents = allTheEntityComponents.get(entityIndex);
AliveComponent aliveComponent = entityComponents.aliveComponent;
float aliveTime = aliveComponent.getTime() - GlobalTime.getDelta();
aliveComponent.setTime(aliveTime);
if (aliveTime <= 0) {
Entity e = allTheEntityComponents.getKey(entityIndex);
StoreComponent storeComponent = StoreComponent.get(e);
if (storeComponent != null)
storeComponent.store.free(e);
else
e.delete();
}
}
}
Aggregations