Package com.tankz.components

Examples of com.tankz.components.Expiration


    smallestLifeTime = Integer.MAX_VALUE;
  }

  @Override
  protected void process(Entity e, int accumulatedDelta) {
    Expiration expiration = expirationMapper.get(e);

    expiration.reduceLifeTime(accumulatedDelta);

    if (expiration.isExpired()) {
      world.deleteEntity(e);
    } else if (expiration.getLifeTime() < smallestLifeTime) {
      smallestLifeTime = expiration.getLifeTime();
    }
  }
View Full Code Here


    }
  }

  @Override
  protected void added(Entity e) {
    Expiration expiration = expirationMapper.get(e);
    if (!isRunning() || expiration.getLifeTime() < getRemainingTimeUntilProcessing()) {
      startDelayedRun(expiration.getLifeTime());
    }
  }
View Full Code Here

public class EntityFactory {
  public static Entity createExplosion(World world, float x, float y) {
    Entity e = world.createEntity();
    e.addComponent(new Transform(x, y));
    e.addComponent(new SpatialForm("explosion"));
    e.addComponent(new Expiration(200));
    e.addToWorld();
    return e;
  }
View Full Code Here

    Entity e = world.createEntity();
    world.getManager(GroupManager.class).add(e, "bullets");
    Transform transform = new Transform(x, y, angle);
    e.addComponent(transform);
    e.addComponent(new SpatialForm("bullet"));
    e.addComponent(new Expiration(1500));

    Body b = new Body(new Box(10, 10), 0.2f);
    b.setUserData(e);
    b.addExcludedBody(shooter.getComponent(Physics.class).getBody());
    b.setBitmask(1);
View Full Code Here

TOP

Related Classes of com.tankz.components.Expiration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.