Search in sources :

Example 1 with TextureActuator

use of ilargia.egdx.logicbricks.component.actuator.TextureActuator in project Entitas-Java by Rubentxu.

the class ActuatorEntity method addTextureActuator.

public ActuatorEntity addTextureActuator(Bounds bounds, int opacity, Boolean flipX, Boolean flipY, Color tint) {
    TextureActuator component = (TextureActuator) recoverComponent(ActuatorComponentsLookup.TextureActuator);
    if (component == null) {
        component = new TextureActuator(bounds, opacity, flipX, flipY, tint);
    } else {
        component.actuator = (indexOwner) -> {
            GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
            TextureView view = owner.getTextureView();
            if (bounds != null)
                view.bounds = bounds;
            if (flipX != null)
                view.flipX = flipX;
            if (flipY != null)
                view.flipY = flipY;
            if (opacity != -1)
                view.opacity = opacity;
            if (tint != null)
                view.tint = tint;
        };
    }
    addComponent(ActuatorComponentsLookup.TextureActuator, component);
    return this;
}
Also used : GameEntity(ilargia.egdx.logicbricks.gen.game.GameEntity) TextureView(ilargia.egdx.logicbricks.component.game.TextureView) TextureActuator(ilargia.egdx.logicbricks.component.actuator.TextureActuator)

Example 2 with TextureActuator

use of ilargia.egdx.logicbricks.component.actuator.TextureActuator in project Entitas-Java by Rubentxu.

the class ActuatorEntity method replaceTextureActuator.

public ActuatorEntity replaceTextureActuator(Bounds bounds, int opacity, Boolean flipX, Boolean flipY, Color tint) {
    TextureActuator component = (TextureActuator) recoverComponent(ActuatorComponentsLookup.TextureActuator);
    if (component == null) {
        component = new TextureActuator(bounds, opacity, flipX, flipY, tint);
    } else {
        component.actuator = (indexOwner) -> {
            GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
            TextureView view = owner.getTextureView();
            if (bounds != null)
                view.bounds = bounds;
            if (flipX != null)
                view.flipX = flipX;
            if (flipY != null)
                view.flipY = flipY;
            if (opacity != -1)
                view.opacity = opacity;
            if (tint != null)
                view.tint = tint;
        };
    }
    replaceComponent(ActuatorComponentsLookup.TextureActuator, component);
    return this;
}
Also used : GameEntity(ilargia.egdx.logicbricks.gen.game.GameEntity) TextureView(ilargia.egdx.logicbricks.component.game.TextureView) TextureActuator(ilargia.egdx.logicbricks.component.actuator.TextureActuator)

Example 3 with TextureActuator

use of ilargia.egdx.logicbricks.component.actuator.TextureActuator in project Entitas-Java by Rubentxu.

the class ActuatorSystem method execute.

@Override
public void execute(float deltaTime) {
    for (ActuatorEntity e : groupTexture.getEntities()) {
        if (e.getLink().isOpen) {
            TextureActuator textureActuator = e.getTextureActuator();
            textureActuator.actuator.execute(e.getLink().ownerEntity);
        }
    }
    for (ActuatorEntity e : groupVelocity.getEntities()) {
        if (e.getLink().isOpen) {
            VelocityActuator velocityActuator = e.getVelocityActuator();
            velocityActuator.actuator.execute(e.getLink().ownerEntity);
        }
    }
    for (ActuatorEntity e : groupCamera.getEntities()) {
        if (e.getLink().isOpen) {
            CameraActuator cameraActuator = e.getCameraActuator();
            cameraActuator.actuator.execute(e.getLink().ownerEntity);
        }
    }
    for (ActuatorEntity e : groupEffect.getEntities()) {
        if (e.getLink().isOpen) {
            ParticleEffectActuator effectActuator = e.getParticleEffectActuator();
            effectActuator.actuator.execute(e.getLink().ownerEntity);
        }
    }
}
Also used : ParticleEffectActuator(ilargia.egdx.logicbricks.component.actuator.ParticleEffectActuator) CameraActuator(ilargia.egdx.logicbricks.component.actuator.CameraActuator) TextureActuator(ilargia.egdx.logicbricks.component.actuator.TextureActuator) ActuatorEntity(ilargia.egdx.logicbricks.gen.actuator.ActuatorEntity) VelocityActuator(ilargia.egdx.logicbricks.component.actuator.VelocityActuator)

Aggregations

TextureActuator (ilargia.egdx.logicbricks.component.actuator.TextureActuator)3 TextureView (ilargia.egdx.logicbricks.component.game.TextureView)2 GameEntity (ilargia.egdx.logicbricks.gen.game.GameEntity)2 CameraActuator (ilargia.egdx.logicbricks.component.actuator.CameraActuator)1 ParticleEffectActuator (ilargia.egdx.logicbricks.component.actuator.ParticleEffectActuator)1 VelocityActuator (ilargia.egdx.logicbricks.component.actuator.VelocityActuator)1 ActuatorEntity (ilargia.egdx.logicbricks.gen.actuator.ActuatorEntity)1