/**
   * When scanning a robot we need to add it to the collection of scanned objects so it can be used
   * later for updates to the bots movement.
   */
  public void onScannedRobot(ScannedRobotEvent e) {
    double targetBearing = getHeading() + e.getBearing();
    double tmpX = getX() + e.getDistance() * Math.sin(Math.toRadians(targetBearing));
    double tmpY = getY() + e.getDistance() * Math.cos(Math.toRadians(targetBearing));
    String name = e.getName();

    if (name.equals(GOAL_NAME)) {
      foundGoal = true;
    }

    obstacles.put(name, new Enemy(tmpX, tmpY, e.getBearing()));

    setTurnRadarRight(getRadarTurnRemaining());
  }
示例#2
0
 /** Returns the priority of a ScannedRobotEvent. */
 public int getScannedRobotEventPriority() {
   return dummyScannedRobotEvent.getPriority();
 }