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


Java Entity.remove方法代码示例

本文整理汇总了Java中com.badlogic.ashley.core.Entity.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.remove方法的具体用法?Java Entity.remove怎么用?Java Entity.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.ashley.core.Entity的用法示例。


在下文中一共展示了Entity.remove方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: placeTowers

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
private void placeTowers(int button) {
	if (_isPlacementMode) {
		Tile tile = getTileAtMouse();
		ImmutableArray<Entity> towerEntitys = getAshleyEngine().getEntitiesFor(_towerFamily);
		Entity first = towerEntitys.first();
		first.remove(MouseImageComponent.class);
		first.getComponent(PositionComponent.class).position.x = tile.getCords().x;
		first.getComponent(PositionComponent.class).position.y = tile.getCords().y;
		first.add(new OffsetComponent(16, 16));
		tile.setType(TileType.WALL);
		tile.setEntity(first);
		getAshleyEngine().getSystem(TowerPlacementSystem.class).tintTile(null);
		InputHandler.setPlacementMode(false);
		_ef.getPlayer().getComponent(MoneyComponent.class).money -= first.getComponent(TowerStatComponent.class)._buyCost;
	}
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:17,代码来源:InputHandler.java

示例2: update

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
@Override
public void update(Entity e, float deltaTime, Level level) {
    if (done) return;
    
    PositionComponent pos = PositionComponent.MAPPER.get(e);
    VelocityComponent vel = VelocityComponent.MAPPER.get(e);
    if (vel == null) {
        vel = new VelocityComponent();
        e.add(vel);
    }
    ShipComponent ship = ShipComponent.MAPPER.get(e);
    if (speed < 0) speed = ship.moveSpeed;

    double dx   = x - pos.getX();
    double dy   = y - pos.getY();
    double dist = Math.hypot(dx, dy);
    if (dist < speed * deltaTime) {
        done = true;
        pos.setX((float) x);
        pos.setY((float) y);
        e.remove(VelocityComponent.class);
    } else {
        vel.vx = (float) (speed * dx / dist);
        vel.vy = (float) (speed * dy / dist);
    }
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:27,代码来源:MoveOrder.java

示例3: update

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
@Override
public void update(Entity e, float deltaTime, Level level) {
    if (done) {
        return;
    }
    
    PositionComponent pos = PositionComponent.MAPPER.get(e);
    VelocityComponent vel = VelocityComponent.MAPPER.get(e);
    if (vel == null) {
        vel = new VelocityComponent();
        e.add(vel);
    }

    double dx = x - pos.getX();
    double dy = y - pos.getY();
    if (time < 0) {
        done = true;
        pos.setX((float) x);
        pos.setY((float) y);
        e.remove(VelocityComponent.class);
    } else {
        vel.vx = (float) (dx / time);
        vel.vy = (float) (dy / time);
        time -= deltaTime;
    }
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:27,代码来源:TimeMoveOrder.java

示例4: receiveObstacle

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
private void receiveObstacle(ByteBuffer buffer) {
    Entity entity = entityFactory.createObstacle();
    entity.remove(NetworkAddComponent.class);
    TransformComponent transform = transformMapper.get(entity);
    MovementComponent movement = movementMapper.get(entity);
    transform.position.x = buffer.getFloat();
    transform.position.y = buffer.getFloat();
    movement.velocity.x = buffer.getFloat();
    movement.velocity.y = buffer.getFloat();
    getEngine().addEntity(entity);
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:12,代码来源:NetworkSystem.java

示例5: receiveBullet

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
private void receiveBullet(String playerId, ByteBuffer buffer) {
//        Gdx.app.debug(TAG, "receiveBullet: ");
        Entity entity = entityFactory.createBullet(playerId);
        entity.remove(NetworkAddComponent.class);
        TransformComponent transform = transformMapper.get(entity);
        MovementComponent movement = movementMapper.get(entity);
        transform.position.x = buffer.getFloat();
        transform.position.y = buffer.getFloat();
        movement.velocity.x = buffer.getFloat();
        movement.velocity.y = buffer.getFloat();
        getEngine().addEntity(entity);
    }
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:13,代码来源:NetworkSystem.java

示例6: onEntityDestroyed

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
@Override
public void onEntityDestroyed(Engine engine, Entity entity, Entity source) {
    AnimationComponent animation = new AnimationComponent();
    // TODO: 31-Mar-17 Figure out why this line sometime causes a null reference
    animation.removeEntityAfterAnimation = true;
    animation.frames.addAll(ServiceLocator.getAppComponent().getAnimationFactory().getMediumExplosion());
    entity.add(animation);
    world.audioService.playSound(AssetService.SoundAsset.SOUND_EXPLOSION_WAV);
    entity.remove(CollisionComponent.class);
    entity.remove(MovementComponent.class);
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:12,代码来源:World.java

示例7: update

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
@Override
public void update(Entity e, float deltaTime, Level level) {
    if (done) return;
    
    RotationComponent         rot = RotationComponent.MAPPER.get(e);
    RotationVelocityComponent vel = RotationVelocityComponent.MAPPER.get(e);
    if (vel == null) {
        vel = new RotationVelocityComponent();
        e.add(vel);
    }
    
    float dr = (float) (r - rot.r);
    //Fix the angle
    while (dr < -180) {
        dr += 360;
    }
    //Fix the angle
    while (dr > 180) {
        dr -= 360;
    }
    
    if (Math.abs(dr) < rotateSpeed * deltaTime) {
        done = true;
        rot.r = (float) r;
        e.remove(RotationVelocityComponent.class);
        
    } else {
        vel.vr = (float) (Math.signum(dr) * rotateSpeed);
    }
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:31,代码来源:FaceOrder.java

示例8: processEntity

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
private void processEntity(Entity entity, float deltaTime) {
    OrderComponent order = OrderComponent.MAPPER.get(entity);
    
    if (order.size() == 0) {
        entity.remove(OrderComponent.class);
        return;
    }
    
    order.initAll(entity, level, this);
    
    while (order.size() > 0 && !order.peek().isValidFor(entity)) {
        order.pop();
    }
    
    if (order.size() == 0) {
        entity.remove(OrderComponent.class);
        return;
    }
    
    order.peek().update(entity, deltaTime, level);
    if (order.peek().completed(entity)) {
        order.pop();
    }
    if (order.size() == 0) {
        entity.remove(OrderComponent.class);
    }
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:28,代码来源:OrderSystem.java

示例9: removeEffect

import com.badlogic.ashley.core.Entity; //导入方法依赖的package包/类
@Override
protected void removeEffect(PooledEngine engine, Entity entity, EffectComponent effectComponent) {
    Gdx.app.debug(TAG, "removeEffect: ");
    entity.remove(DamageComponent.class);
    healthComponent.ignoredEntities = oldHealthIgnore;
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:7,代码来源:InvulnerabilityEffect.java


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