本文整理汇总了Java中com.badlogic.ashley.core.EntitySystem类的典型用法代码示例。如果您正苦于以下问题:Java EntitySystem类的具体用法?Java EntitySystem怎么用?Java EntitySystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntitySystem类属于com.badlogic.ashley.core包,在下文中一共展示了EntitySystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSystem
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private <ES extends EntitySystem> ES getSystem(Class<ES> clazz) {
ES entitySystem = engine.getSystem(clazz);
if (entitySystem == null) {
try {
Constructor constructor = findConstructor(clazz);
entitySystem = (ES) constructor.newInstance((Object[]) null);
} catch (Exception ex) {
Log.debug(tag, "Error instance entitySystem %s", clazz.getSimpleName());
}
if (entitySystem != null) {
engine.addSystem(entitySystem);
} else {
Log.debug(tag, "Error instance entitySystem %s", clazz.getSimpleName());
}
}
return entitySystem;
}
示例2: dispose
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void dispose() {
logger.info("dispose");
for (EntitySystem system : engine.getSystems()) {
if (system instanceof Disposable) {
((Disposable)system).dispose();
}
}
}
示例3: addInputProcessors
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private void addInputProcessors() {
logger.info("enabling engine input processors");
InputMultiplexer inputMultiplexer = Env.getGame().getMultiplexer();
inputMultiplexer.addProcessor(this);
for (EntitySystem system : engine.getSystems()) {
if (system instanceof InputProcessor) {
inputMultiplexer.addProcessor((InputProcessor)system);
}
}
}
示例4: removeInputProcessors
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private void removeInputProcessors() {
logger.info("disabling engine input processors");
InputMultiplexer inputMultiplexer = Env.getGame().getMultiplexer();
inputMultiplexer.removeProcessor(this);
for (EntitySystem system : engine.getSystems()) {
if (system instanceof InputProcessor) {
inputMultiplexer.removeProcessor((InputProcessor)system);
}
}
}
示例5: renderSystems
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private void renderSystems() {
for (EntitySystem system : getEngine().getSystems()) {
if (system instanceof DebugRenderer) {
DebugRenderer renderer = (DebugRenderer)system;
renderer.render(shapeRenderer);
}
}
}
示例6: pause
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void pause()
{
for (EntitySystem sys : engine.getSystems())
{
sys.setProcessing(false);
}
engine.getSystem(UiSystem.class).setProcessing(true);
Mappers.gameSettingsMap.get(gameWorld).setPaused(true);
}
示例7: resume
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void resume()
{
for (EntitySystem sys : engine.getSystems())
{
sys.setProcessing(true);
}
Mappers.gameSettingsMap.get(gameWorld).setPaused(false);
}
示例8: dispose
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void dispose() {
Gdx.app.log(TAG, "disposing instance");
removeAllEntities();
clearPools();
for (EntitySystem system : getSystems()) {
if (system instanceof Disposable) {
((Disposable) system).dispose();
}
system = null;
removeSystem(system);
}
}
示例9: dispose
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void dispose() {
System.out.println("Disposing: " + this.getClass().getSimpleName());
// clean up after self
// dispose of spritebatches and textures
for (EntitySystem sys : engine.getSystems()) {
if (sys instanceof Disposable)
((Disposable) sys).dispose();
}
//TODO: use entity listener instead
//Family family = Family.all(TextureComponent.class).get();
//engine.addEntityListener(family, listener);
//github.com/libgdx/ashley/wiki/How-to-use-Ashley#entity-events
for (Entity ents : engine.getEntitiesFor(Family.all(TextureComponent.class).get())) {
TextureComponent tex = ents.getComponent(TextureComponent.class);
if (tex != null)
tex.texture.dispose();
}
engine.removeAllEntities();//THIS FIXES IT!
engine = null;
//System.gc();//not good practice, just testing
//super.dispose();
}
示例10: activeLogicBrickSystemProcessing
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
private void activeLogicBrickSystemProcessing(boolean active) {
Iterator<EntitySystem> it = engine.getSystems().iterator();
while (it.hasNext()) {
EntitySystem system = it.next();
if (system instanceof LogicBrickSystem) system.setProcessing(active);
}
}
示例11: removeAllSystems
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
/**
* Remove all systems from the ecs engine
*/
public void removeAllSystems() {
for (EntitySystem system : engine.getSystems()) {
engine.removeSystem(system);
}
}
示例12: show
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
@Override
public void show() {
Objects.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
Objects.world = new World(new Vector2(0,0), false);
Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1f);
entityEngine = new Engine();
entityEngine.addEntity(EntityUtils.createPlayer());
entityEngine.addSystem(new RemoveEntityTimerSystem());
entityEngine.addSystem(new PlayerSystem());
entityEngine.addSystem(new AStarSystem());
entityEngine.addSystem(new Box2DToSpritePositionSystem());
entityEngine.addSystem(new LightFollowPlayerSystem());
entityEngine.addSystem(new MapControllerSystem(game));
entityEngine.addSystem(new RendererSystem());
entityEngine.addSystem(new Box2DLightsSystem());
//entityEngine.addSystem(new Box2DDebugRendererSystem());
entityEngine.addSystem(new DrawInfoSystem());
entityEngine.addSystem(new DrawPossibleFloorPlacementsSystem());
entityEngine.addSystem(new RemoveFloorSystem());
ImmutableArray<EntitySystem> systems = entityEngine.getSystems();
for(int i = 0; i < systems.size(); i++){ // It must have a Initializable
Initializable init = (Initializable) systems.get(i);
init.init();
}
for(int i = 0; i < systems.size(); i++){ // It must not have a Createable
if(systems.get(i) instanceof Createable){
Createable create = (Createable) systems.get(i);
create.create();
}
}
Objects.camera.zoom = Values.CAMERA_ZOOM;
Objects.camera.translate(new Vector2(CameraSize.getWidth() / 2, CameraSize.getHeight() / 2));;
}
示例13: pause
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
public void pause() {
for (EntitySystem system : engine.getSystems()) {
system.setProcessing(false);
}
}
示例14: resume
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
public void resume() {
for (EntitySystem system : engine.getSystems()) {
system.setProcessing(true);
}
}
示例15: printSystems
import com.badlogic.ashley.core.EntitySystem; //导入依赖的package包/类
public static void printSystems(Engine eng) {
for (EntitySystem sys : eng.getSystems()) {
System.out.println(sys + " (" + sys.priority + ")");
}
}