use of ilargia.egdx.logicbricks.component.actuator.VelocityActuator 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.VelocityActuator in project Entitas-Java by Rubentxu.
the class ActuatorEntity method replaceVelocityActuator.
public ActuatorEntity replaceVelocityActuator(Vector2 velocity, float angularVelocity) {
VelocityActuator component = (VelocityActuator) recoverComponent(ActuatorComponentsLookup.VelocityActuator);
if (component == null) {
component = new VelocityActuator(velocity, angularVelocity);
} else {
component.actuator = (indexOwner) -> {
GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
RigidBody rigidBody = owner.getRigidBody();
rigidBody.body.setLinearVelocity(velocity);
rigidBody.body.setAngularVelocity(angularVelocity);
};
}
replaceComponent(ActuatorComponentsLookup.VelocityActuator, component);
return this;
}
use of ilargia.egdx.logicbricks.component.actuator.VelocityActuator in project Entitas-Java by Rubentxu.
the class ActuatorEntity method addVelocityActuator.
public ActuatorEntity addVelocityActuator(Vector2 velocity, float angularVelocity) {
VelocityActuator component = (VelocityActuator) recoverComponent(ActuatorComponentsLookup.VelocityActuator);
if (component == null) {
component = new VelocityActuator(velocity, angularVelocity);
} else {
component.actuator = (indexOwner) -> {
GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
RigidBody rigidBody = owner.getRigidBody();
rigidBody.body.setLinearVelocity(velocity);
rigidBody.body.setAngularVelocity(angularVelocity);
};
}
addComponent(ActuatorComponentsLookup.VelocityActuator, component);
return this;
}
Aggregations