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


Java Entity.removeAll方法代码示例

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

示例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);
	}
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:20,代码来源:HealthSystem.java

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

}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:35,代码来源:MoveToSystem.java


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