本文整理汇总了Java中com.artemis.World类的典型用法代码示例。如果您正苦于以下问题:Java World类的具体用法?Java World怎么用?Java World使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
World类属于com.artemis包,在下文中一共展示了World类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWorld
import com.artemis.World; //导入依赖的package包/类
protected World createWorld() {
final RenderBatchingSystem renderBatchingSystem;
return new World(new WorldConfigurationBuilder()
.dependsOn(OperationsPlugin.class)
.with(WorldConfigurationBuilder.Priority.HIGH,
// supportive
new SuperMapper(),
new TagManager(),
new CameraSystem(1),
new FeatureScreenAssetSystem(),
new OdbFeatureDetectionSystem()
).with(WorldConfigurationBuilder.Priority.LOW,
// processing
new TransitionSystem(GdxArtemisGame.getInstance()),
// animation
new ClearScreenSystem(Color.valueOf("969291")),
renderBatchingSystem = new RenderBatchingSystem(),
new AnimRenderSystem(renderBatchingSystem),
new FeatureScreenSetupSystem()
).build());
}
示例2: createWorld
import com.artemis.World; //导入依赖的package包/类
protected World createWorld() {
final RenderBatchingSystem renderBatchingSystem;
return new World(new WorldConfigurationBuilder()
.dependsOn(OperationsPlugin.class)
.with(WorldConfigurationBuilder.Priority.HIGH,
// supportive
new TagManager(),
new CameraSystem(1),
new FeatureScreenAssetSystem(),
new OdbFeatureDetectionSystem()
).with(WorldConfigurationBuilder.Priority.LOW,
// processing
new TransitionSystem(GdxArtemisGame.getInstance()),
// animation
new ClearScreenSystem(Color.valueOf("969291")),
renderBatchingSystem = new RenderBatchingSystem(),
new AnimRenderSystem(renderBatchingSystem),
new FeatureScreenSetupSystem()
).build());
}
示例3: WelcomeScreen
import com.artemis.World; //导入依赖的package包/类
public WelcomeScreen() {
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.update();
Tox.world = new World();
Tox.world.setSystem(new CameraShakeSystem(camera));
Tox.world.setSystem(new SelectableSystem());
Tox.world.setSystem(new SettingSystem());
Tox.world.setSystem(new PhysicsSystem());
Tox.world.setSystem(new ParticleSystem());
Tox.world.setSystem(new AnimationRenderSystem(camera));
Tox.world.setSystem(new HighscoreSystem(camera));
Tox.world.setSystem(new ContinueSystem(false));
Tox.world.setSystem(new SoundSystem());
Tox.world.initialize();
EntityFactory.createGradientBackground().addToWorld();
EntityFactory.createScreen("dialog-welcome").addToWorld();
}
示例4: ComponentMappers
import com.artemis.World; //导入依赖的package包/类
private ComponentMappers(final World world) {
facing = ComponentMapper.getFor(FacingComponent.class, world);
health = ComponentMapper.getFor(HealthComponent.class, world);
position = ComponentMapper.getFor(PositionComponent.class, world);
animation = ComponentMapper.getFor(AnimationComponent.class, world);
facingAnimation = ComponentMapper.getFor(FacingAnimationComponent.class, world);
sprite = ComponentMapper.getFor(SpriteComponent.class, world);
name = ComponentMapper.getFor(NameComponent.class, world);
highlight = ComponentMapper.getFor(HighlightAbleComponent.class, world);
camera = ComponentMapper.getFor(CameraFollowComponent.class, world);
collectible = ComponentMapper.getFor(CollectibleComponent.class, world);
player = ComponentMapper.getFor(PlayerComponent.class, world);
cursor = ComponentMapper.getFor(CursorComponent.class, world);
turn = ComponentMapper.getFor(TurnComponent.class, world);
ai = ComponentMapper.getFor(ArtificialIntelligenceComponent.class, world);
}
示例5: createWorld
import com.artemis.World; //导入依赖的package包/类
protected World createWorld() {
final RenderBatchingSystem renderBatchingSystem;
return new World(new WorldConfigurationBuilder()
.with(
new TagManager()
)
.with(
// supportive
new CameraSystem(1),
new FeatureScreenAssetSystem(),
new OdbFeatureDetectionSystem()
).with(
// processing
new SchedulerSystem(),
new TransitionSystem(GdxArtemisGame.getInstance()),
new ColorAnimationSystem()
).with(
// animation
new ClearScreenSystem(Color.valueOf("969291")),
renderBatchingSystem = new RenderBatchingSystem(),
new AnimRenderSystem(renderBatchingSystem),
new FeatureScreenSetupSystem()
).build());
}
示例6: Region
import com.artemis.World; //导入依赖的package包/类
public Region(int xSize, int ySize, int zSize) {
this.xSize = xSize;
this.ySize = ySize;
this.zSize = zSize;
tiles = new TileType[xSize][ySize][zSize];
building = new Building[xSize][ySize][zSize];
jobs = new Job[xSize][ySize][zSize];
TileType vacuum = TileType.types.get("VACUUM");
for (int x = 0; x < xSize; x++) {
for (int y = 0; y < ySize; y++) {
for (int z = 0; z < zSize; z++) {
tiles[x][y][z] = vacuum;
}
}
}
// we will need to initialize this before we use it.
world = new World();
}
示例7: createWorld
import com.artemis.World; //导入依赖的package包/类
@Override
protected World createWorld() {
RenderBatchingSystem renderBatchingSystem;
return new World(new WorldConfigurationBuilder()
.dependsOn(EntityLinkManager.class, ProfilerPlugin.class, OperationsPlugin.class)
.with(
new SuperMapper(),
// Replace with your own systems!
new CameraSystem(1),
new ClearScreenSystem(Color.valueOf(BACKGROUND_COLOR_HEX)),
new GameScreenAssetSystem(),
new GameScreenSetupSystem(),
renderBatchingSystem = new RenderBatchingSystem(),
new AnimRenderSystem(renderBatchingSystem)
).build());
}
示例8: createExplosion
import com.artemis.World; //导入依赖的package包/类
public static void createExplosion(World world, float x, float y,
float xVel, float yVel) {
Entity e = createBasicEntity(world, x, y, Constants.Explosion.WIDTH,
Constants.Explosion.HEIGHT,
xVel * Constants.Explosion.VEL_PERC, yVel
* Constants.Explosion.VEL_PERC, 0, NO_HEALTH);
SingleSpriteComp ssc = world.createComponent(SingleSpriteComp.class);
ssc.name = Constants.Explosion.NAME;
ssc.tint = Color.WHITE;
e.addComponent(ssc);
TimeDelComp tdc = world.createComponent(TimeDelComp.class);
tdc.setValues(Constants.Explosion.LIFE_TIME);
e.addComponent(tdc);
e.addToWorld();
}
示例9: createArmy
import com.artemis.World; //导入依赖的package包/类
public static Entity createArmy(World world, MapPosition pos, String name, Empire empire, Entity source,
int militaryPower) {
Entity e = world.createEntity();
EntityEdit edit = e.edit();
edit.add(new Counter(Colors.contrast(empire.color), empire.color, militaryPower));
edit.add(pos).add(new Name(name)).add(new Description(name))
.add(new Destination(source.getComponent(ArmyCommand.class).forbiddenTiles, 1))
.add(new Army(source, militaryPower)).add(empire);
if (empire.isComputerControlled())
edit.add(new AIControlled());
return e;
}
示例10: createFadingTileIcon
import com.artemis.World; //导入依赖的package包/类
public static Entity createFadingTileIcon(World world, TextureRegion icon, Color color, float x, float y,
float duration) {
Entity e = world.createEntity();
EntityEdit edit = e.edit();
MutableMapPosition position = edit.create(MutableMapPosition.class);
position.x = x;
position.y = y;
FadingMessage fading = edit.create(FadingMessage.class);
fading.icon = icon;
fading.color = color;
fading.duration = duration;
fading.vx = 0f;
fading.vy = 1.3f;
return e;
}
示例11: DeferredSystem_EntityAdded_RegisteredWithPrincipal
import com.artemis.World; //导入依赖的package包/类
@Test
public void DeferredSystem_EntityAdded_RegisteredWithPrincipal() {
EntityProcessPrincipal principal = mock(EntityProcessPrincipal.class);
final WorldConfiguration config = new WorldConfiguration();
config.setSystem(new TestDeferredSystem(Aspect.all(EmptyComponent.class), principal));
// setup world and single entity.
World w = new World(config);
Entity myEntity = new EntityBuilder(w).with(EmptyComponent.class).build();
w.process();
// ensure it gets registered with the principal
verify(principal, times(1)).registerAgent(eq(myEntity.getId()), any(EntityProcessAgent.class));
}
示例12: createDefensiveSpecial
import com.artemis.World; //导入依赖的package包/类
public static boolean createDefensiveSpecial(World world,
DefensiveSpecialType type, float sourceX, float sourceY) {
if (type == DefensiveSpecialType.NONE) {
return false;
}
if (type == DefensiveSpecialType.SHIELD) {
createShield(world, sourceX, sourceY);
}
if (type == DefensiveSpecialType.INVINCIBLITY) {
createInvincibility(world, sourceX, sourceY);
}
return true;
}
示例13: addShipOffense
import com.artemis.World; //导入依赖的package包/类
private static Entity addShipOffense(World world, Entity e, int topL,
int midL, int botL, int baseDmg, float fireRate) {
// Level data
LevelComp lc = world.createComponent(LevelComp.class);
lc.setValues(topL, midL, botL);
e.addComponent(lc);
DamageComp dc = world.createComponent(DamageComp.class);
// TODO better damage calculation??
dc.damage = baseDmg;
e.addComponent(dc);
FireRateComp frc = world.createComponent(FireRateComp.class);
frc.setValues(fireRate);
e.addComponent(frc);
return e;
}
示例14: createHint
import com.artemis.World; //导入依赖的package包/类
private static void createHint(HudRenderingComponent component,
Skin skin, Table table, TaflWorld gameWorld) {
final World world = gameWorld.world;
TextureRegion textureRegion = new TextureRegion(
gameWorld.game.graphicsService.getSprite(
Assets.GraphicFiles.ATLAS_PIECES, Assets.Icons.HINT));
Drawable imageUp = new TextureRegionDrawable(textureRegion);
ImageButton button = new ImageButton(imageUp);
button.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
HintEvent undoEvent = SystemEvent.createEvent(HintEvent.class);
world.postEvent(null, undoEvent);
}
});
table.add(button).size(gameWorld.game.deviceSettings.hudButtonHeight).expandX();
}
示例15: createMenu
import com.artemis.World; //导入依赖的package包/类
private static void createMenu(HudRenderingComponent component,
Skin skin, Table table, final TaflWorld gameWorld) {
final World world = gameWorld.world;
TextureRegion textureRegion = new TextureRegion(
gameWorld.game.graphicsService.getSprite(
Assets.GraphicFiles.ATLAS_PIECES, Assets.Icons.MENU));
Drawable imageUp = new TextureRegionDrawable(textureRegion);
ImageButton button = new ImageButton(imageUp);
button.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
LifeCycleEvent lifecycleEvent = SystemEvent.createEvent(LifeCycleEvent.class);
lifecycleEvent.lifecycle = LifeCycle.MENU;
world.postEvent(null, lifecycleEvent);
}
});
table.add(button).size(gameWorld.game.deviceSettings.hudButtonHeight).expandX();
}