예제 #1
0
  private boolean buildingIsIsolated(Building position) {
    Graph graph = world.getPlatoonAgent().getPathPlanner().getGraph();

    for (Entrance entrance : world.getMrlBuilding(position.getID()).getEntrances()) {
      if (graph.getNodeBetweenAreas(position.getID(), entrance.getID(), null).isPassable()) {
        return false;
      }
    }
    return true;
  }
예제 #2
0
  private boolean isInPreviousArea(EntityID areaId) {
    String lastCommand = world.getPlatoonAgent().getLastCommand();

    if (lastCommand == null) {
      return false;
    }
    if (lastCommand.equalsIgnoreCase("Move") || lastCommand.equalsIgnoreCase("Move To Point")) {
      if (areaId.equals(previousPosition)) {
        stayInSamePositionCounter++;
        if (stayInSamePositionCounter > 6) {
          //                    world.printData(" i Am in isolated are.....");
          return true;
        }
      } else {
        stayInSamePositionCounter = 0;
        previousPosition = areaId;
      }
    }
    return false;
  }