Search in sources :

Example 1 with Input

use of com.ilargia.games.logicbrick.component.input.Input in project Entitas-Java by Rubentxu.

the class InputEntity method replaceInput.

public InputEntity replaceInput(int x, int y) {
    Input component = (Input) recoverComponent(InputComponentsLookup.Input);
    if (component == null) {
        component = new Input(x, y);
    } else {
        component.x = x;
        ;
        component.y = y;
    }
    replaceComponent(InputComponentsLookup.Input, component);
    return this;
}
Also used : Input(com.ilargia.games.logicbrick.component.input.Input)

Example 2 with Input

use of com.ilargia.games.logicbrick.component.input.Input in project Entitas-Java by Rubentxu.

the class InputEntity method addInput.

public InputEntity addInput(int x, int y) {
    Input component = (Input) recoverComponent(InputComponentsLookup.Input);
    if (component == null) {
        component = new Input(x, y);
    } else {
        component.x = x;
        ;
        component.y = y;
    }
    addComponent(InputComponentsLookup.Input, component);
    return this;
}
Also used : Input(com.ilargia.games.logicbrick.component.input.Input)

Example 3 with Input

use of com.ilargia.games.logicbrick.component.input.Input 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

Input (com.ilargia.games.logicbrick.component.input.Input)3 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 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