use of ilargia.egdx.logicbricks.gen.game.GameEntity in project Entitas-Java by Rubentxu.
the class RadarSensorSystem method processCollision.
@Override
public void processCollision(Fixture colliderA, Fixture colliderB, boolean collisionSignal) {
if (colliderA.isSensor() && !colliderB.isSensor()) {
Integer indexEntityA = (Integer) colliderA.getBody().getUserData();
Integer indexEntityB = (Integer) colliderB.getBody().getUserData();
String tagSensorA = (String) colliderA.getUserData();
if (indexEntityA != null && indexEntityB != null && tagSensorA != null && tagSensorA.equals("RadarSensor")) {
GameEntity entityB = Indexed.getInteractiveEntity(indexEntityB);
if (entityB != null) {
for (SensorEntity entity : sensorGroup.getEntities()) {
RadarSensor radar = entity.getRadarSensor();
if (entityB.getTags().values.contains(radar.targetTag)) {
if (collisionSignal) {
Indexed.addEntityInSensor(entity, entityB);
} else {
Indexed.removeEntityInSensor(entity, entityB);
}
radar.collisionSignal = collisionSignal;
}
}
}
}
}
}
use of ilargia.egdx.logicbricks.gen.game.GameEntity in project Entitas-Java by Rubentxu.
the class PlatformExamples method createScene.
@Override
public void createScene(Engine engine, Entitas entitas) {
AssetsManagerGDX assetsManager = engine.getManager(AssetsManagerGDX.class);
assetsManager.loadTexture("assets/imagenes/fondos/fondo.jpg");
assetsManager.loadTexture("assets/imagenes/fondos/nubes.png");
assetsManager.loadTexture("assets/imagenes/fondos/arboles.png");
assetsManager.finishLoading();
// entitas.scene.createEntity()
// .addParallaxLayer(new TextureRegion(assetsManager.getTexture("assets/imagenes/fondos/fondo.jpg"))
// , new Vector2(0.7f,0f),new Vector2(0, 1),new Vector2(0, 0));
entitas.scene.createEntity().addParallaxLayer(new TextureRegion(assetsManager.getTexture("assets/imagenes/fondos/nubes.png")), new Vector2(0.5f, 1.0f), new Vector2(0, 10), new Vector2(0, 0));
entitas.scene.createEntity().addParallaxLayer(new TextureRegion(assetsManager.getTexture("assets/imagenes/fondos/arboles.png")), new Vector2(0.9f, 0), new Vector2(0, -0.4f), new Vector2(0, 0));
// entitas.scene.createEntity()
// .addCPointLight(55, Color.GOLD, 45, new Vector2(10,4));
// entitas.scene.createEntity()
// .addCChainLight(25, Color.FOREST, 180, 145, new float[]{-5, 0, 0, 0, 0, 0,30,12});
// entitas.scene.createEntity()
// .addCDirectionalLight(84, Color.SKY, 270);
entitas.scene.createEntity().addCConeLight(35, Color.GREEN, 40, new Vector2(16, 13), 250, 60);
SceneManagerGDX sceneManager = engine.getManager(SceneManagerGDX.class);
GameEntity ground = sceneManager.createEntity("Ground");
ground.getRigidBody().body.setTransform(10, 1, 0);
GameEntity mariano = sceneManager.createEntity("Mariano");
mariano.getRigidBody().body.setTransform(10, 6, 0);
GameEntity box1 = sceneManager.createEntity("Box");
box1.addTags("Box");
box1.getRigidBody().body.setTransform(20, 7, 0);
GameEntity box2 = sceneManager.createEntity("Box");
box2.addTags("Box2");
box2.getRigidBody().body.setTransform(25, 7, 0);
entitas.actuator.setDragActuator(ground.getCreationIndex(), false, 1000);
}
Aggregations