예제 #1
0
    public override void RecieveHit(List<object> senders, int hitID, HitInfo hitInfo)
    {
        // no hit if same hitID
        if (hitID == lastHitID) return;
        lastHitID = hitID;

        int damage = 0;
        // no damage applied if invincible or have Strong Attack Armor
        if (!invincible && attackArmor != AttackArmor.Strong)
        {
            hitInfo.Defend(statManager.defenseStoutness.value, myTransform.position, ((MonoBehaviour)senders[0]).transform.position);
            damage = hitInfo.damage;

            // status effect
            if (hitInfo.effect != HitInfo.Effects.None)
            {
                damage = Mathf.CeilToInt(damage * statusEffectivenesses[(int)hitInfo.effect]);
                if (damage > 0)
                {
                    Log(hitInfo.effect + ":" + (int)hitInfo.effect, Debugger.LogTypes.Combat);
                    StopAllCoroutines();
                    StartCoroutine(statusMethods[(int)hitInfo.effect], damage);
                }
            }

            ChangeHealth(-damage);
            CreateIndicator(damage);
        }

        //if (HitEvent != null)
        //{
        //    HitEvent(senders, new HitEventArgs(hitInfo, currentHealth, damage));
        //}

        OnGroupHitEvent(senders, new HitEventArgs(hitInfo, currentHealth, damage));
    }