use of ilargia.egdx.logicbricks.component.actuator.ParticleEffectActuator in project Entitas-Java by Rubentxu.
the class ActuatorEntity method addParticleEffectActuator.
public ActuatorEntity addParticleEffectActuator(ParticleEffect effect, boolean autoStart, float locaPosX, float locaPosY) {
ParticleEffectActuator component = (ParticleEffectActuator) recoverComponent(ActuatorComponentsLookup.ParticleEffectActuator);
if (component == null) {
component = new ParticleEffectActuator(effect, autoStart, locaPosX, locaPosY);
} else {
component.particleEffect = effect;
component.actuator = (indexOwner) -> {
GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
RigidBody rc = owner.getRigidBody();
Transform transform = rc.body.getTransform();
effect.setPosition(transform.getPosition().x + locaPosX, transform.getPosition().y + locaPosY);
effect.update(Gdx.graphics.getDeltaTime());
if (autoStart && effect.isComplete())
effect.start();
};
}
addComponent(ActuatorComponentsLookup.ParticleEffectActuator, component);
return this;
}
use of ilargia.egdx.logicbricks.component.actuator.ParticleEffectActuator in project Entitas-Java by Rubentxu.
the class TextureRendererSystem method render.
@Override
public void render() {
batch.setProjectionMatrix(cam.combined);
batch.begin();
for (GameEntity e : groupTextureView.getEntities()) {
TextureView view = e.getTextureView();
Body body = e.getRigidBody().body;
processTextureFlip(view);
batch.setColor(1f, 1f, 1f, 1f);
if (view.opacity < 1)
batch.setColor(1f, 1f, 1f, view.opacity);
batch.draw(view.texture, body.getPosition().x - view.bounds.extentsX, body.getPosition().y - view.bounds.extentsY, view.bounds.extentsX, view.bounds.extentsY, view.bounds.extentsX * 2, view.bounds.extentsY * 2, 1, 1, MathUtils.radiansToDegrees * body.getTransform().getRotation());
}
for (ActuatorEntity e : groupEffect.getEntities()) {
if (e.getLink().isOpen) {
ParticleEffectActuator effectActuator = e.getParticleEffectActuator();
effectActuator.particleEffect.draw(batch);
}
}
batch.end();
}
use of ilargia.egdx.logicbricks.component.actuator.ParticleEffectActuator 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);
}
}
}
use of ilargia.egdx.logicbricks.component.actuator.ParticleEffectActuator in project Entitas-Java by Rubentxu.
the class ActuatorEntity method replaceParticleEffectActuator.
public ActuatorEntity replaceParticleEffectActuator(ParticleEffect effect, boolean autoStart, float locaPosX, float locaPosY) {
ParticleEffectActuator component = (ParticleEffectActuator) recoverComponent(ActuatorComponentsLookup.ParticleEffectActuator);
if (component == null) {
component = new ParticleEffectActuator(effect, autoStart, locaPosX, locaPosY);
} else {
component.particleEffect = effect;
component.actuator = (indexOwner) -> {
GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
RigidBody rc = owner.getRigidBody();
Transform transform = rc.body.getTransform();
effect.setPosition(transform.getPosition().x + locaPosX, transform.getPosition().y + locaPosY);
effect.update(Gdx.graphics.getDeltaTime());
if (autoStart && effect.isComplete())
effect.start();
};
}
replaceComponent(ActuatorComponentsLookup.ParticleEffectActuator, component);
return this;
}
Aggregations