示例#1
0
  /** gets called when Level is initialized */
  public void init() {
    Log.info("initializing level...");

    interfaces.add(score);

    entities.add(new AbilityLogic(this), TickEvent.class);
    entities.add(new BasicLogic(this), TickEvent.class, DeathEvent.class, DamageEvent.class);
    entities.add(new Building(this), TickEvent.class);
    entities.add(new DestroyedOnContact(this), CollisionEvent.class);
    entities.add(new EnemyDeath(this), DeathEvent.class);
    entities.add(new EnergizerLogic(this), TickEvent.class);
    entities.add(new ProjectileLogic(this), DeathEvent.class, CollisionEvent.class);
    entities.add(new TimeToLife(this), TickEvent.class);

    CollisionChecking collision = new CollisionChecking(this);
    collision.addCollisionRule(CollisionGroup.H, CollisionGroup.A);
    collision.addCollisionRule(CollisionGroup.H, CollisionGroup.B);
    collision.addCollisionRule(CollisionGroup.A, CollisionGroup.B);
    collision.addCollisionRule(CollisionGroup.B, CollisionGroup.A);

    collision.dellCollisionRule(CollisionGroup.B, CollisionGroup.B);
    collision.dellCollisionRule(CollisionGroup.A, CollisionGroup.A);
    collision.dellCollisionRule(CollisionGroup.H, CollisionGroup.H);

    entities.add(collision, TickOnceEvent.class, EntityAddEvent.class, EntityDelEvent.class);

    entities.updateEntityList();
    entities.logicHandler.updateLogics();
  }
示例#2
0
 /**
  * ads an entity to the level
  *
  * @param entity
  */
 public void add(BaseEntity entity) {
   entities.add(entity);
 }