Search in sources :

Example 1 with InputEntity

use of com.ilargia.games.logicbrick.gen.input.InputEntity in project Entitas-Java by Rubentxu.

the class ProcessInputSystem method execute.

@Override
protected void execute(List<InputEntity> entities) {
    InputEntity inputEntity = entities.get(0);
    Input input = inputEntity.getInput();
    Set<GameEntity> interactives = EntityIndexExtension.getEntitiesWithPosition(entitas.game, input.x, input.y).stream().filter(e -> e.isInteractive()).collect(Collectors.toSet());
    for (GameEntity e : interactives) {
        e.setDestroy(true);
    }
}
Also used : Collector(com.ilargia.games.entitas.collector.Collector) List(java.util.List) GameEntity(com.ilargia.games.logicbrick.gen.game.GameEntity) Input(com.ilargia.games.logicbrick.component.input.Input) IContext(com.ilargia.games.entitas.api.IContext) InputEntity(com.ilargia.games.logicbrick.gen.input.InputEntity) InputMatcher(com.ilargia.games.logicbrick.gen.input.InputMatcher) Set(java.util.Set) EntityIndexExtension(com.ilargia.games.entitas.EntityIndexExtension) Entitas(com.ilargia.games.entitas.core.Entitas) InputContext(com.ilargia.games.logicbrick.gen.input.InputContext) Collectors(java.util.stream.Collectors) GameEntity(com.ilargia.games.logicbrick.gen.game.GameEntity) Input(com.ilargia.games.logicbrick.component.input.Input) InputEntity(com.ilargia.games.logicbrick.gen.input.InputEntity)

Aggregations

EntityIndexExtension (com.ilargia.games.entitas.EntityIndexExtension)1 IContext (com.ilargia.games.entitas.api.IContext)1 Collector (com.ilargia.games.entitas.collector.Collector)1 Entitas (com.ilargia.games.entitas.core.Entitas)1 Input (com.ilargia.games.logicbrick.component.input.Input)1 GameEntity (com.ilargia.games.logicbrick.gen.game.GameEntity)1 InputContext (com.ilargia.games.logicbrick.gen.input.InputContext)1 InputEntity (com.ilargia.games.logicbrick.gen.input.InputEntity)1 InputMatcher (com.ilargia.games.logicbrick.gen.input.InputMatcher)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1