本文整理汇总了Java中com.badlogic.ashley.core.Engine.getEntitiesFor方法的典型用法代码示例。如果您正苦于以下问题:Java Engine.getEntitiesFor方法的具体用法?Java Engine.getEntitiesFor怎么用?Java Engine.getEntitiesFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.ashley.core.Engine
的用法示例。
在下文中一共展示了Engine.getEntitiesFor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: intervalSystem
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Test
public void intervalSystem () {
Engine engine = new Engine();
IntervalIteratingSystemSpy intervalSystemSpy = new IntervalIteratingSystemSpy();
ImmutableArray<Entity> entities = engine.getEntitiesFor(Family.all(IntervalComponentSpy.class).get());
ComponentMapper<IntervalComponentSpy> im = ComponentMapper.getFor(IntervalComponentSpy.class);
engine.addSystem(intervalSystemSpy);
for (int i = 0; i < 10; ++i) {
Entity entity = new Entity();
entity.add(new IntervalComponentSpy());
engine.addEntity(entity);
}
for (int i = 1; i <= 10; ++i) {
engine.update(deltaTime);
for (int j = 0; j < entities.size(); ++j) {
assertEquals(i / 2, im.get(entities.get(j)).numUpdates);
}
}
}
示例2: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
this.engine = engine;
entities = engine.getEntitiesFor(Family.all(PlainPosition.class).get());
// engine.addEntityListener(new EntityListener() {
//
// @Override
// public void entityRemoved(Entity entity) {
// engine.remove(entity.getIndex());
// }
//
// @Override
// public void entityAdded(Entity entity) {
// entities.put(entity.getIndex(), entity);
// }
// });
for (int i = 0; ENTITY_COUNT > i; i++)
createEntity();
}
示例3: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
for (int i = 0; permutations.length > i; i++) {
Array<Class<? extends Component>> components = new Array<Class<? extends Component>>();
for (int classIndex = 0, s = (int)(rng.nextFloat() * 7) + 3; s > classIndex; classIndex++) {
components.add(types.get((int)(rng.nextFloat() * types.size)));
}
permutations[i] = components;
}
this.engine = engine;
entities = engine.getEntitiesFor(Family.all().get());
for (int i = 0; ENTITY_COUNT > i; i++)
createEntity();
}
示例4: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
this.engine = (PooledEngine) engine;
entities = engine.getEntitiesFor(Family.all(PlainPosition.class).get());
// engine.addEntityListener(new EntityListener() {
//
// @Override
// public void entityRemoved(Entity entity) {
// entities.remove(entity.getIndex());
// }
//
// @Override
// public void entityAdded(Entity entity) {
// entities.put(entity.getIndex(), entity);
// }
// });
for (int i = 0; ENTITY_COUNT > i; i++)
createEntity();
}
示例5: intervalSystem
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Test
public void intervalSystem() {
Engine engine = new Engine();
IntervalIteratingSystemSpy intervalSystemSpy = new IntervalIteratingSystemSpy();
ImmutableArray<Entity> entities = engine.getEntitiesFor(Family.getFor(IntervalComponentSpy.class));
ComponentMapper<IntervalComponentSpy> im = ComponentMapper.getFor(IntervalComponentSpy.class);
engine.addSystem(intervalSystemSpy);
for (int i = 0; i < 10; ++i) {
Entity entity = new Entity();
entity.add(new IntervalComponentSpy());
engine.addEntity(entity);
}
for (int i = 1; i <= 10; ++i) {
engine.update(deltaTime);
for (int j = 0; j < entities.size(); ++j) {
assertEquals(i / 2, im.get(entities.get(j)).numUpdates);
}
}
}
示例6: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
super.addedToEngine(engine);
syncedEntities = engine.getEntitiesFor(Family.all(PlayerClass.class).get());
engine.addEntityListener(Family.all(NetworkAddComponent.class).get(), this);
player = engine.getEntitiesFor(Family.all(NetworkSyncComponent.class, PlayerClass.class, IdComponent.class).get());
}
示例7: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
super.addedToEngine(engine);
damageSystem.getDamageListeners().add(this);
players = engine.getEntitiesFor(Family.all(PlayerClass.class, IdComponent.class).get());
}
示例8: initialize
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
public void initialize(Engine engine) {
vao = glGenVertexArrays();
glBindVertexArray(vao);
entities = engine.getEntitiesFor(Family.all(Pose.class, Gestalt.class).get());
lights = engine.getEntitiesFor(Family.all(Pose.class, Light.class).get());
initDefaultShader();
initPostShaders();
camSys = engine.getSystem(CameraSystem.class);
initFullscreenQuad();
}
示例9: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine (Engine engine) {
ImmutableArray<Entity> newEntities = engine.getEntitiesFor(family);
sortedEntities.clear();
if (newEntities.size() > 0) {
for (int i = 0; i < newEntities.size(); ++i) {
sortedEntities.add(newEntities.get(i));
}
sortedEntities.sort(comparator);
}
shouldSort = false;
engine.addEntityListener(family, this);
}
示例10: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
public void addedToEngine (Engine engine)
{
super.addedToEngine(engine);
engine.addEntityListener(family, Integer.MAX_VALUE, this);
doors = engine.getEntitiesFor(family);
doorsToOpen = new Array<Entity>();
doorsToClose = new Array<Entity>();
}
示例11: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
super.addedToEngine(engine);
observables = engine.getEntitiesFor(
Family.all(ObservableComponent.class).get()
);
engine.addEntityListener(getFamily(), this);
}
示例12: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
this.engine = engine;
// currently loaded stars/planets
loadedStars = engine.getEntitiesFor(Family.all(StarComponent.class, TransformComponent.class).get());
// generate or load points from disk
loadPoints();
// load planetary systems / planets / stars
// load space things (asteroids, wormhole, black hole, etc)
// load ai/mobs
}
示例13: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
this.engine = engine;
missiles = engine.getEntitiesFor(Family.all(MissileComponent.class, BoundsComponent.class).get());
vehicles = engine.getEntitiesFor(Family.all(VehicleComponent.class, BoundsComponent.class).get());
characters = engine.getEntitiesFor(Family.all(CharacterComponent.class, BoundsComponent.class).get());
}
示例14: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
super.addedToEngine(engine);
vehicles = engine.getEntitiesFor(Family.all(VehicleComponent.class).get());
//players = engine.getEntitiesFor(Family.all(CameraFocusComponent.class, ControllableComponent.class).get());
planets = engine.getEntitiesFor(Family.all(PlanetComponent.class).get());
this.engine = engine;
}
示例15: addedToEngine
import com.badlogic.ashley.core.Engine; //导入方法依赖的package包/类
@Override
public void addedToEngine(Engine engine) {
this.engine = engine;
mapableObjects = engine.getEntitiesFor(Family.all(MapComponent.class, TransformComponent.class).get());
player = engine.getEntitiesFor(Family.all(CameraFocusComponent.class, ControllableComponent.class).get());
killables = engine.getEntitiesFor(Family.all(HealthComponent.class, TransformComponent.class).exclude(CameraFocusComponent.class).get());
}