private void updateAttackHit ( ) { if ( ! attacking ) { for ( final AttackerListener listener : listeners ) { listener . notifyAttackStarted ( target ) ; } attacking = true ; attacked = false ; } // Hit when frame attack reached if ( animator . getFrame ( ) >= frameAttack ) { attacking = false ; for ( final AttackerListener listener : listeners ) { listener . notifyAttackEnded ( damages . getRandom ( ) , target ) ; } attacked = true ; tick . restart ( ) ; } }
Update the attack state and hit when possible .