Пример #1
0
  @Override
  public void checkHit(@Nullable vector inDirection) {
    // System.out.println("MeleeAttack: checkHit() starting");
    if (possibleVictum != null
        && owner.loc.distanceSquared(possibleVictum.loc) < Rpg.getMeleeAttackRangeSquared()) {
      possibleVictum.takeDamage(owner.getDamage(), owner);
      return;
    }

    if (inDirection != null) {
      checkHitHere.set(inDirection);
      checkHitHere.times(Rpg.getMeleeAttackRange()).add(owner.loc);

      // Log.d( "MeleeAttack" , "checkHit(): checkHitHere = " + checkHitHere);

      inThisArea.set(weaponStrikePercArea);

      inThisArea.offset(checkHitHere.x, checkHitHere.y);

      // Log.d( "MeleeAttack" , "inThisArea=" + inThisArea);
      // System.out.println("owner.getTeam()=" + owner.getTeam());

      possibleVictum = cd.checkSingleHit(owner.getTeamName(), inThisArea);

      if (possibleVictum != null) {
        possibleVictum.takeDamage(owner.getDamage(), owner);

        if (weapon.wasDrawnThisFrame()) playHitSound(weaponType, owner.loc.x, owner.loc.y);
      } else {
        if (weapon.wasDrawnThisFrame()) playMissSound(weaponType, owner.loc.x, owner.loc.y);
      }
    }

    // System.out.println("MeleeAttack: checkHit() ending");
  }
 public void pointerLeftScreen(int pointer) {
   if (pointer == pointerID) {
     pointerID = -1;
     downAt.set(-1, -1);
   }
 }