Ejemplo n.º 1
0
  @Override
  public boolean checkMobParticleHit(Particle p) {
    if (gameController.multiplayerMode != gameController.multiplayerMode.CLIENT) {
      Monster monster = null;

      try {
        for (String key : monsters.keySet()) {
          monster = (Monster) monsters.get(key);
          if (monster.getPerimeter().intersects(p.getRect())) {
            monster.applyDamage(p.getDamage(), p.getSource(), p.isFromPlaceable(), false);
            return true;
          }
        }
      } catch (ConcurrentModificationException concEx) {
        // another thread was trying to modify monsters while iterating
        // we'll continue and the new item can be grabbed on the next update
      }
    }

    return false;
  }
Ejemplo n.º 2
0
  public void calcFitness(LinkedList<PatternList> l) throws IOException {

    float fit = Particle.calcFitness(this.dimensions, l);

    this.fitness = fit;
  }