Ejemplo n.º 1
0
 /**
  * Follow the waypoint stored in currentWaypoint
  *
  * @param defuseMines whether or not to defuse mines while following waypoints
  * @throws GameActionException
  */
 public static void followWaypoints(boolean defuseMines, boolean swarm)
     throws GameActionException {
   // If we're close to currentWaypoint, find the next one
   if (rc.getLocation().distanceSquaredTo(destination) <= Constants.PATH_GO_ALL_IN_SQ_RADIUS) {
     // Stop nav-ing?
     navMode = NavMode.REGULAR;
     // We're done following waypoints
     if (defuseMines) {
       goToLocation(destination);
     } else {
       goToLocationAvoidMines(destination);
     }
   } else if (rc.getLocation().distanceSquaredTo(currentWaypoint)
       <= Constants.WAYPOINT_SQUARED_DISTANCE_CHECK) {
     // We're close to currentWaypoint, so find the next one
     switch (navMode) {
       case SMART:
         getSmartWaypoint();
         break;
       case BACKDOOR:
         getBackdoorWaypoint();
         break;
       default:
         break;
     }
     if (defuseMines) {
       if (swarm) {
         //					rc.setIndicatorString(2, currentWaypoint.toString());
         goToLocationSwarm(currentWaypoint, true);
       } else {
         goToLocation(currentWaypoint);
       }
     } else {
       if (swarm) {
         goToLocationSwarm(currentWaypoint, false);
       } else {
         goToLocationAvoidMines(currentWaypoint);
       }
     }
   } else {
     // Keep moving to the current waypoint
     if (defuseMines) {
       if (swarm) {
         //					rc.setIndicatorString(2, currentWaypoint.toString());
         goToLocationSwarm(currentWaypoint, true);
       } else {
         goToLocation(currentWaypoint);
       }
     } else {
       if (swarm) {
         goToLocationSwarm(currentWaypoint, false);
       } else {
         goToLocationAvoidMines(currentWaypoint);
       }
     }
   }
 }