本文整理汇总了Java中com.artemis.Entity类的典型用法代码示例。如果您正苦于以下问题:Java Entity类的具体用法?Java Entity怎么用?Java Entity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Entity类属于com.artemis包,在下文中一共展示了Entity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.artemis.Entity; //导入依赖的package包/类
@Override
protected void initialize() {
super.initialize();
addBackground();
addLogo();
final Entity featureEntity = tagManager.getEntity(OdbFeatureDetectionSystem.FEATURES_TAG);
final OdbFeatureComponent featureComponent = featureEntity.getComponent(OdbFeatureComponent.class);
addFeatureIcon(featureComponent.isHotspotOptimization, "feature-hotspot");
addFeatureIcon(featureComponent.isPacked, "feature-packed");
addFeatureIcon(featureComponent.isPooled, "feature-pooled");
addFeatureIcon(featureComponent.isFactory, "feature-factory");
scheduleTransitionToGameScreen();
}
示例2: process
import com.artemis.Entity; //导入依赖的package包/类
@Override
protected void process(E e) {
final Entity cursor = tagManager.getEntity("cursor");
if ( cursor != null )
{
// update state based on cursor.
final Clickable clickable = e.getClickable();
final boolean overlapping = system.overlaps(cursor, e.entity());
if ( overlapping )
{
clickable.state = leftMousePressed ? Clickable.ClickState.CLICKED : Clickable.ClickState.HOVER;
} else {
clickable.state = Clickable.ClickState.NONE;
}
}
}
示例3: createBackground
import com.artemis.Entity; //导入依赖的package包/类
private void createBackground() {
Entity e = new DynastyEntityBuilder(world)
.with(new Anim("SKY"))
.with(Pos.class, Renderable.class, Scale.class)
.build();
mRenderable.get(e).layer = -100;
mScale.get(e).scale = G.ZOOM;
mPos.get(e).xy.y = 133 * G.ZOOM;
e = new DynastyEntityBuilder(world)
.with(new Anim("DESERT"))
.with(Pos.class, Renderable.class, Scale.class)
.build();
mRenderable.get(e).layer = 100;
mScale.get(e).scale = G.ZOOM;
}
示例4: createLogo
import com.artemis.Entity; //导入依赖的package包/类
private void createLogo() {
float y = G.CANVAS_HEIGHT * 0.75f - (AssetSystem.LOGO_HEIGHT / 2) * G.ZOOM;
float x = G.CANVAS_WIDTH * 0.5f - (AssetSystem.LOGO_WIDTH / 2) * G.ZOOM;
Entity e = new DynastyEntityBuilder(world)
.with(new Anim("LOGO"))
.schedule(
OperationFactory.parallel(
OperationFactory.tween(new Pos(x, y - 5 * G.ZOOM), new Pos(x, y + 5 * G.ZOOM), 6f),
OperationFactory.sequence(
OperationFactory.tween(new Tint("ffffff00"), new Tint("ffffffff"), 0.5f),
OperationFactory.delay(4),
OperationFactory.tween(new Tint("ffffffff"), new Tint("ffffff00"), 0.5f)
)))
.with(Pos.class, Renderable.class, Scale.class)
.build();
mRenderable.get(e).layer = 2000;
mScale.get(e).scale = G.ZOOM;
mPos.get(e).xy.y = y;
mPos.get(e).xy.x = x;
}
示例5: createStructure
import com.artemis.Entity; //导入依赖的package包/类
private Entity createStructure(int x, int y, String animId, String tag, float burrowPercentage, float burrowTargetPercentage, int width, int height, int speed, int layer) {
Entity entity = Anims.createCenteredAt(world,
width,
height,
animId,
G.ZOOM);
mRenderable.get(entity).layer = layer;
mPos.get(entity).xy.set(x - (width * G.ZOOM * 0.5f), y);
if (tag != null) {
tagManager.register(tag, entity);
}
Burrow burrow = mBurrow.create(entity);
burrow.percentage = burrowPercentage;
burrow.smokeLayer = layer + 1;
burrow.targetPercentage = burrowTargetPercentage;
burrow.speed = speed;
burrow.surfaceY = y;
return entity;
}
示例6: initialize
import com.artemis.Entity; //导入依赖的package包/类
@Override
protected void initialize() {
super.initialize();
addBackground();
addLogo();
final Entity featureEntity = tagManager.getEntity(OdbFeatureDetectionSystem.FEATURES_TAG);
final OdbFeatureComponent featureComponent = featureEntity.getComponent(OdbFeatureComponent.class);
addFeatureIcon(featureComponent.isHotspotOptimization, "feature-hotspot");
addFeatureIcon(featureComponent.isPacked, "feature-packed");
addFeatureIcon(featureComponent.isPooled, "feature-pooled");
addFeatureIcon(featureComponent.isFactory, "feature-factory");
scheduleTransitionToGameScreen();
}
示例7: addFeatureIcon
import com.artemis.Entity; //导入依赖的package包/类
private void addFeatureIcon(boolean state, String iconId) {
final float scale = Anims.scaleToScreenRounded(0.08f, FeatureScreenAssetSystem.FEATURE_WIDTH);
final float iconBorderMargin = scale * FEATURE_BORDER_MARGIN;
final float iconOffset = ((scale * FeatureScreenAssetSystem.FEATURE_WIDTH) + iconBorderMargin);
float cX = Gdx.graphics.getWidth() - iconOffset * ++iconIndex;
float cY = iconBorderMargin;
final Entity entity = Anims.createAnimAt(world,
(int) cX,
(int) cY,
iconId,
scale);
if (state) {
animateAvailable(cX, cY, entity);
} else {
animateMissing(cX, cY, entity);
}
}
示例8: addLogo
import com.artemis.Entity; //导入依赖的package包/类
public void addLogo() {
// approximate percentage of screen size with logo. Use rounded numbers to keep the logo crisp.
float zoom = Anims.scaleToScreenRounded(0.8f, FeatureScreenAssetSystem.LOGO_WIDTH);
final Entity entity = Anims.createCenteredAt(world,
FeatureScreenAssetSystem.LOGO_WIDTH,
FeatureScreenAssetSystem.LOGO_HEIGHT,
"logo",
zoom);
E.edit(entity)
.tint(COLOR_LOGO_FADED)
.schedule(
scaleBetween(zoom * 2, zoom, 2f, Interpolation.bounceOut),
tween(new Tint(COLOR_LOGO_FADED), new Tint(COLOR_LOGO_FULL), 2f, Interpolation.fade)
);
}
示例9: spawn
import com.artemis.Entity; //导入依赖的package包/类
public Entity spawn(String id, int productivity, String deathSfx) {
System.out.println("Spawn " + id);
Entity e = new DynastyEntityBuilder(world).with(
new Bounds(0, 0, 0, 0),
new Anim(id))
.with(Pos.class, Scale.class,
Renderable.class, Physics.class, Gravity.class, Tint.class, ZPos.class)
.schedule(tween(new Tint(TINT_INVISIBLE), new Tint("ffffffff"), 0.5f))
.minion(productivity).build();
randomizeLocation(e);
Physics physics = mPhysics.get(e);
physics.vy = 500;
physics.friction = 20f;
mColor.get(e).setHex(TINT_INVISIBLE);
mScale.get(e).scale = G.ZOOM;
mRenderable.get(e).layer = MINION_LAYER;
mMinion.get(e).deathSfx = deathSfx;
return e;
}
示例10: process
import com.artemis.Entity; //导入依赖的package包/类
@Override
protected void process(Entity e) {
final Entity cursor = tagManager.getEntity("cursor");
if ( cursor != null )
{
// update state based on cursor.
final Clickable clickable = mClickable.get(e);
final boolean overlapping = system.overlaps(cursor, e);
if ( overlapping )
{
clickable.state = leftMousePressed ? Clickable.ClickState.CLICKED : Clickable.ClickState.HOVER;
} else {
clickable.state = Clickable.ClickState.NONE;
}
}
}
示例11: addLogo
import com.artemis.Entity; //导入依赖的package包/类
public void addLogo() {
// approximate percentage of screen size with logo. Use rounded numbers to keep the logo crisp.
final Entity entity = Anims.createCenteredAt(world,
FeatureScreenAssetSystem.LOGO_WIDTH,
FeatureScreenAssetSystem.LOGO_HEIGHT,
"logo",
Anims.scaleToScreenRounded(0.8f, FeatureScreenAssetSystem.LOGO_WIDTH));
entity.edit()
.add(new Color(COLOR_LOGO_FADED))
.add(new Schedule()
.add(newLogoAppearColorAnimation())
.wait(0.5f));
}
示例12: process
import com.artemis.Entity; //导入依赖的package包/类
@Override
protected void process(Entity e) {
final Entity cursor = tagManager.getEntity("cursor");
if ( cursor != null )
{
// update state based on cursor.
final Clickable clickable = mClickable.get(e);
final boolean overlapping = system.overlaps(cursor, e);
if ( overlapping )
{
clickable.state =
middleMouseTapped ? Clickable.ClickState.CLICKED_MIDDLE :
rightMouseTapped ? Clickable.ClickState.CLICKED_RIGHT :
leftMouseTapped ? Clickable.ClickState.CLICKED_LEFT : Clickable.ClickState.HOVER;
} else {
clickable.state = Clickable.ClickState.NONE;
}
}
}
示例13: process
import com.artemis.Entity; //导入依赖的package包/类
@Override
protected void process(Entity e) {
if ( isWithinGrid() )
{
moveToDragLocation(e);
tintIndicator(e);
if ( !leftButtonDown ) {
if ( canDropHere(e) ) {
abstractAssetSystem.playSfx("drop");
actuallyMoveSubject(e);
}
e.deleteFromWorld();
}
}
}
示例14: createRandomArmor
import com.artemis.Entity; //导入依赖的package包/类
public static Entity createRandomArmor(int x, int y) {
String animId = "vest1";
String pickupSfx = "tox_sfx_armor_pickup";
int defenseBonus = 1;
int randomBonus = 0;
switch ( MathUtils.random(0, 2) )
{
case 1:
animId = "vest2";
defenseBonus = 1; randomBonus =1;
break;
}
Animation animation = new Animation(animId, Animation.Layer.TILE);
return
Tox.world
.createEntity()
.addComponent(new Reward(Score.POINTS_GRAB_ITEM))
.addComponent(new Position(x, y))
.addComponent(new EquipBonus(0, defenseBonus + MathUtils.random(0,randomBonus)))
.addComponent(animation)
.addComponent(new Lootable(Lootable.Effect.BODY_PICKUP, pickupSfx, null)).addComponent(new Selectable());
}
示例15: replace
import com.artemis.Entity; //导入依赖的package包/类
public Entity replace( Entity ingredient, Ingredient.Type type) {
final Pos sourcePos = mPos.get(ingredient);
ingredient.deleteFromWorld();
ingredient = setupSystem.createIngredient(0,0, type);
final Pos newIngredient = mPos.get(ingredient);
newIngredient.x = sourcePos.x;
newIngredient.y = sourcePos.y;
if ( type == Ingredient.Type.BLOOD) {
mSpawnProtected.create(ingredient);
mAngle.create(ingredient).rotation = MathUtils.random(0,360f);
mWet.create(ingredient).liquid = ShowerLiquid.BLOOD;
abstractAssetSystem.playSfx("chick-squeek");
} else {
abstractAssetSystem.playSfx("flatten-eye");
}
return ingredient;
}