use of ilargia.egdx.logicbricks.gen.game.GameEntity in project Entitas-Java by Rubentxu.
the class AnimationSystem method execute.
@Override
public void execute(float deltaTime) {
for (GameEntity e : _groupAnimation.getEntities()) {
Animations animations = e.getAnimations();
TextureView view = e.getTextureView();
animations.time += deltaTime;
Animation<TextureRegion> animation = animations.currentAnimation;
if (animation != null) {
view.texture = animation.getKeyFrame(animations.time);
}
}
}
use of ilargia.egdx.logicbricks.gen.game.GameEntity in project Entitas-Java by Rubentxu.
the class DestroySystem method execute.
@Override
protected void execute(List<GameEntity> entities) {
for (GameEntity e : entities) {
if (e.hasRigidBody()) {
Body body = e.getRigidBody().body;
e.getRigidBody().body = null;
body.setUserData(null);
removeBodies.add(body);
}
context.destroyEntity(e);
}
}
use of ilargia.egdx.logicbricks.gen.game.GameEntity in project Entitas-Java by Rubentxu.
the class CreateRadialGravityActuatorSystem method execute.
@Override
protected void execute(List<ActuatorEntity> actuatorEntities) {
for (ActuatorEntity e : actuatorEntities) {
RadialGravityActuator actuator = e.getRadialGravityActuator();
GameEntity owner = Indexed.getInteractiveEntity(e.getLink().ownerEntity);
entitas.sensor.createEntity().addNearSensor("", actuator.radius, 0).addLink("RadialGravitySensor", owner.getCreationIndex());
}
}
use of ilargia.egdx.logicbricks.gen.game.GameEntity in project Entitas-Java by Rubentxu.
the class RaySensorSystem method reportRayFixture.
float reportRayFixture(RaySensor sensor, Fixture fixture) {
Integer indexEntity = (Integer) fixture.getBody().getUserData();
sensor.collisionSignal = false;
GameEntity entity = Indexed.getInteractiveEntity(indexEntity);
if (sensor.targetTag != null && entity.getTags().values.contains(sensor.targetTag)) {
sensor.rayContactList.add(indexEntity);
sensor.collisionSignal = true;
} else if (sensor.targetTag == null) {
sensor.rayContactList.add(indexEntity);
sensor.collisionSignal = true;
}
if (sensor.xRayMode)
return 1;
else
return 0;
}
use of ilargia.egdx.logicbricks.gen.game.GameEntity in project Entitas-Java by Rubentxu.
the class RaySensorSystem method query.
@Override
protected boolean query(SensorEntity sensorEntity, float deltaTime) {
RaySensor sensor = sensorEntity.getRaySensor();
sensor.rayContactList.clear();
sensor.collisionSignal = false;
Link link = sensorEntity.getLink();
float angle = sensor.axis2D.ordinal() * 90.0f;
GameEntity originEntity = Indexed.getInteractiveEntity(link.ownerEntity);
Vector2 point1 = originEntity.getRigidBody().body.getPosition();
Vector2 point2 = point1.cpy().add(new Vector2((float) MathUtils.cosDeg(angle), MathUtils.sinDeg(angle)).scl(sensor.range));
physics.rayCast((fixture, point, normal, fraction) -> reportRayFixture(sensor, fixture), point1, point2);
return sensor.collisionSignal;
}
Aggregations