예제 #1
0
 public void OnReceiveAttack(vDamage damage, vIMeleeFighter attacker)
 {
     // character is blocking
     if (!damage.ignoreDefense && isBlocking && meleeManager != null && meleeManager.CanBlockAttack(attacker.Character().transform.position))
     {
         var damageReduction = meleeManager.GetDefenseRate();
         if (damageReduction > 0)
         {
             damage.ReduceDamage(damageReduction);
         }
         if (attacker != null && meleeManager != null && meleeManager.CanBreakAttack())
         {
             attacker.OnRecoil(meleeManager.GetDefenseRecoilID());
         }
         meleeManager.OnDefense();
         cc.currentStaminaRecoveryDelay = damage.staminaRecoveryDelay;
         cc.currentStamina -= damage.staminaBlockCost;
     }
     // apply damage
     cc.TakeDamage(damage, !isBlocking);
 }