use of com.ilargia.games.entitas.index.EntityIndex in project Entitas-Java by Rubentxu.
the class EntityIndexExtension method addEntityIndices.
public static void addEntityIndices(Entitas contexts) {
EntityIndex<GameEntity, Integer> positionIndex = new EntityIndex(contexts.game.getGroup(GameMatcher.Position()), (e, c) -> {
Position positionComponent = (Position) c;
return positionComponent != null ? (positionComponent.x << shiftX) + positionComponent.y : (((GameEntity) e).getPosition().x << shiftX) + ((GameEntity) e).getPosition().y;
});
contexts.game.addEntityIndex(PositionKey, positionIndex);
}
Aggregations