当前位置: 首页>>代码示例>>Java>>正文


Java Engine.getEntitiesFor方法代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:DevelopersGuild,项目名称:Planetbase,代码行数:24,代码来源:IntervalIteratingTest.java

示例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();
	}
 
开发者ID:junkdog,项目名称:entity-system-benchmarks,代码行数:20,代码来源:EntityDeleterSystem.java

示例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();
}
 
开发者ID:junkdog,项目名称:entity-system-benchmarks,代码行数:17,代码来源:EntityManglerSystem.java

示例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();
	}
 
开发者ID:junkdog,项目名称:entity-system-benchmarks,代码行数:20,代码来源:PooledEntityDeleterSystem.java

示例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);
        }
    }
}
 
开发者ID:grum,项目名称:Ashley,代码行数:24,代码来源:IntervalIteratingTest.java

示例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());

}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:9,代码来源:NetworkSystem.java

示例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());

}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:8,代码来源:ScoreSystem.java

示例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();
}
 
开发者ID:urstruktur,项目名称:zierfisch,代码行数:15,代码来源:RenderSystem.java

示例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);
}
 
开发者ID:DevelopersGuild,项目名称:Planetbase,代码行数:14,代码来源:SortedIteratingSystem.java

示例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>();
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:9,代码来源:DoorSystem.java

示例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);
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:9,代码来源:VisionSystem.java

示例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

}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:15,代码来源:SpaceLoadingSystem.java

示例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());
}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:9,代码来源:CollisionSystem.java

示例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;
}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:9,代码来源:AISystem.java

示例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());
}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:8,代码来源:HUDSystem.java


注:本文中的com.badlogic.ashley.core.Engine.getEntitiesFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。