本文整理汇总了Java中com.badlogic.ashley.core.Entity.removeAll方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.removeAll方法的具体用法?Java Entity.removeAll怎么用?Java Entity.removeAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.ashley.core.Entity
的用法示例。
在下文中一共展示了Entity.removeAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processEntity
import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
@Override
protected void processEntity(Entity entity, float deltaTime) {
PositionComponent pcomp = Mappers.POSITION_M.get(entity);
VelocityComponent vcomp = Mappers.VELCOITY_M.get(entity);
OffsetComponent ocomp = Mappers.OFFSET_M.get(entity);
TimeComponent tcomp = Mappers.TIME_M.get(entity);
MoneyComponent mcomp = Mappers.MONEY_M.get(entity);
tcomp.time += deltaTime;
pcomp.position.y += vcomp.maxSpeed * deltaTime;
batch.begin();
batch.setProjectionMatrix(camera.combined);
Assets.fontVeraRg10.getData().setScale(0.5f);
Assets.fontVeraRg10.setColor(1,0.9f,0,1);
Assets.fontVeraRg10.draw(batch , String.format("+%.0f" , mcomp.money),pcomp.position.x + 21 , pcomp.position.y + ocomp.offsetY + 1);
batch.end();
// despawn coin when it has reach its lifetime
if (tcomp.time > tcomp.lifeTime) {
player.getComponent(MoneyComponent.class).money += mcomp.money;
entity.removeAll();
getEngine().removeEntity(entity);
}
}
示例2: processEntity
import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
@Override
protected void processEntity(Entity entity, float deltaTime) {
HealthComponent hpComp = Mappers.HEALTH_M.get(entity);
PositionComponent posComp = Mappers.POSITION_M.get(entity);
EnemyComponent enemyComp = Mappers.ENEMY_M.get(entity);
if (hpComp.isDead) {
float deathX = posComp.position.x;
float deathY = posComp.position.y;
entity.removeAll();
getEngine().removeEntity(entity);
if(enemyComp != null){
PlayState.CURRENT_LIVING_ENEMIES --;
}
_entityFactory.createCoinEntity(deathX, deathY, WaveTimeManager.WAVE + MathUtils.random(1));
}
if(enemyComp != null){
drawHealthBar(hpComp, posComp);
}
}
示例3: processEntity
import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
@Override
protected void processEntity(Entity entity, float deltaTime) {
PositionComponent posComp = Mappers.POSITION_M.get(entity);
PathComponent pathComp = Mappers.PATH_M.get(entity);
AngleComponent angleComp = Mappers.ANGLE_M.get(entity);
VelocityComponent velocityComp = Mappers.VELCOITY_M.get(entity);
OffsetComponent offComp = Mappers.OFFSET_M.get(entity);
Vector2 start = new Vector2((posComp.position.x + offComp.offsetX) / 32,
(posComp.position.y + offComp.offsetY) / 32);
Vector2 end = new Vector2(LevelManager.tileEnd.getCords().x / 32, LevelManager.tileEnd.getCords().y / 32);
// if entity isn't flying update path
// flying enemies doesn't have obstacles so there's no reason for it to
// use findPath method
if (!Families.FLYING.matches(entity)) {
pathComp.path = PathFinder.findPath(start, end, pathComp.canGoDiag, pathComp.isFlying);
}
if (pathComp.path != null) {
float distance = start.cpy().scl(32).dst(end.cpy().scl(32));
if (distance > 25) {
moveTo(posComp, angleComp, deltaTime, pathComp, velocityComp);
} else {
entity.removeAll();
getEngine().removeEntity(entity);
PlayState.CURRENT_LIVING_ENEMIES --;
System.out.println("Enemies left: " + PlayState.CURRENT_LIVING_ENEMIES);
player.getComponent(HealthComponent.class).health--;
}
}
}