Example #1
0
 private void attackingUnit() {
   if (attackedUnit.isDead()) {
     attackedUnit = null;
     unit.setAction(ActionType.NOTHING);
     return;
   }
   MoveBehavior moveBehavior = unit.getMoveBehavior();
   if (((AStarMoveBehavior) moveBehavior)
           .getManhattanDistance(attackedUnit.getPos(), unit.getPos(), false)
       == 1) {
     meleeAttackUnit(attackedUnit);
   } else {
     goToAttackedUnit(moveBehavior);
   }
 }