Exemplo n.º 1
0
    public void onHitRobot(HitRobotEvent event) {
      double angle = peer.getBodyHeading() + event.getBearingRadians();

      hitRobotAngle = (int) (Math.toDegrees(Utils.normalAbsoluteAngle(angle)) + 0.5);
      hitRobotBearing = (int) (event.getBearing() + 0.5);
      JuniorRobot.this.onHitRobot();
    }
 public void onHitRobot(HitRobotEvent e) {
   System.out.println("START at : " + getTime() + " onHitRobot----------------------------");
   // チームメイトなら進む方向を反転する
   String name = e.getName();
   if (isTeammate(name)) {
     moveAmount = -moveAmount;
     System.out.println("Sorry " + name);
   } else {
     for (Enemy_info temp : enes) {
       if (name.equals(temp.get_en_name())) {
         System.out.println("taeget change to " + name);
         target_enemy = temp;
         enemy_detected = true;
         power = power * 3;
       }
     }
   }
   System.out.println("END at : " + getTime() + " onHitRobot----------------------------");
 }