/** onHitRobot: Set him as our new target */ @Override public void onHitRobot_(solomon s, HitRobotEvent e) { // Only print if he's not already our target. if (trackName != null && !trackName.equals(e.getName())) { // out.println("Tracking " + e.getName() + " due to collision"); } // Set the target trackName = e.getName(); // Back up a bit. // Note: We won't get scan events while we're doing this! // An AdvancedRobot might use setBack(); execute(); gunTurnAmt = normalRelativeAngle(e.getBearing() + (s.getHeading() - s.getRadarHeading())); s.turnGunRight(gunTurnAmt); s.fire(3); s.back(50); }
/** @param HitRobotEvent e, The event generated when a robot hit our robot */ public void onHitRobot(HitRobotEvent e) { // if our robots health drops under if ((getEnergy() < LAST_STAND_HEALTH) && (!lastChance)) { lastChance = true; swapPositions(); } current_mode = CLOSE_COMBAT_MODE; printMode(); double gunTurnAmt = normalRelativeAngleDegrees(e.getBearing() + (getHeading() - getRadarHeading())); turnGunRight(gunTurnAmt); fire(3); guyWhoHitMe = e.getName(); // scan(); // if(! isPositionedCorrectly()) // swapPositions(); /* * ahead(500); turnRight(360-getHeading()); * ahead((getBattleFieldHeight()-getY())-50); * * turnRight(90); turnGunRight(getHeading()); turnGunRight(90); * ahead((getBattleFieldWidth()-getX())-50); */ }
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----------------------------"); }