예제 #1
0
  public void run(ArrayList<Creature> creatures) {
    loc = bodyCopy.loc;
    vel = bodyCopy.vel;
    acc = bodyCopy.acc;

    decision.setMove(true);
    decision.setMoveTogheterNeigh(true);

    bodyCopy.addNearCreatures(creatures);
    bodyCopy.removeNearCreatures();
    bodyCopy.addNeighbord(creatures);
    bodyCopy.removeNeighbord();

    setNearCreatures(bodyCopy);
    setNeighbords(bodyCopy);
    setArrayNearDecisions();
    setArrayNeighbordsDecisions();

    action();

    /*
     * bodyCopy.run(creatures);
     *
     * beHunted(creatures); if (isPredator && hungry < 3) { isHunting =
     * true; } else { isHunting = false; } //
     * println(relativeness(creatures,4));
     */
  }
예제 #2
0
  // se outro é predator
  public void beHunted(ArrayList<Creature> creatures) {
    for (Creature other : creatures) {
      float d = PVector.dist(loc, other.loc);

      if (((d > 0) && (d < 40)) && (other.isPredator == true && isPredator == false)) {
        if (other.isHunting) {
          fight(other);
          bodyCopy.fleeFromEnemy(other);
        }
      }
    }
  }
예제 #3
0
 public void stop() {
   if (decision.isMoving() == false) {
     bodyCopy.stop();
   }
 }
예제 #4
0
 public void walkTogheterNeigh(ArrayList<Creature> creatures) {
   if (decision.isMovingTogheterNeigh()) {
     bodyCopy.flock(creatures);
   }
 }
예제 #5
0
 // THE ACTIONS
 public void walkAlone() {
   if (decision.isMoving()) {
     bodyCopy.move();
   }
 }
예제 #6
0
 public void setNearCreatures(Body b) {
   nearCreatures = b.getNearCreatures();
 }
예제 #7
0
 // ///////////////////////////
 // neigh
 public void setNeighbords(Body b) {
   neighbords = b.getNeighbords();
 }