Esempio 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);
       }
     }
   }
 }
Esempio n. 2
0
 /**
  * Sets up the smart navigation system for a given endLocation. This means that we will set
  * navMode = navMode.SMART
  *
  * @param endLocation
  * @throws GameActionException
  */
 public static void setupSmartNav(MapLocation endLocation) throws GameActionException {
   navMode = NavMode.SMART;
   destination = endLocation;
   getSmartWaypoint();
 }