Exemplo n.º 1
0
    public static void HandleHit(ActionController owner, AttackUnit attackUnit, FC_DAMAGE_TYPE damageType, ActionController target)
    {
        if (owner.IsAlived)
        {
            if (owner.ACGetCurrentAttack() != null)
            {
                owner.ACIsHitTarget(target, attackUnit.GetSharpness(), owner.ACGetCurrentAttack()._hitGainEnergy, attackUnit.GetAttackInfo()._isFromSkill);
            }
            else
            {
                owner.ACIsHitTarget(target, 0, false, attackUnit.GetAttackInfo()._isFromSkill);
            }
        }
        if (attackUnit.GetAttackInfo()._damageType != FC_DAMAGE_TYPE.NONE)
        {
            damageType = attackUnit.GetAttackInfo()._damageType;
        }
        if (damageType != FC_DAMAGE_TYPE.NONE &&
            !(target.SuperArmorSelf.ActiveArmor() == FCConst.SUPER_ARMOR_LVL2 &&
              target.SuperArmorSelf.DamageAbsorb(FCConst.SUPER_ARMOR_LVL2) > 0.99f))
        {
            //play blood effect
            Vector3 bloodPos = target.ACGetTransformByName(EnumEquipSlot.belt).position;


            //play blood on ground with random rotation
            int        rotY           = Random.Range(0, 360);
            Quaternion rot            = Quaternion.Euler(0, rotY, 0);
            Vector3    bloodGroundPos = target.ACGetTransformByName(EnumEquipSlot.foot_point).position;
            bloodGroundPos.y -= target.SelfMoveAgent.GetFlyHeight();
            GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.BLOOD_GROUND, bloodGroundPos, rot);

            //play effect by damage type
            switch (damageType)
            {
            case FC_DAMAGE_TYPE.PHYSICAL:
            {
                if (target.HasBloodEffect)
                {
                    //play physical attack effect
                    GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.ATTACK_PHYSICAL
                                                            , bloodPos);

                    GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.BLOOD
                                                            , bloodPos);
                }
            }
            break;

            case FC_DAMAGE_TYPE.FIRE:
            {
                CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.FIRE_ATTACK
                                                           , target._avatarController, -1);
            }
            break;

            case FC_DAMAGE_TYPE.POISON:
            {
                CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_POISON
                                                           , target._avatarController, -1);
            }
            break;

            case FC_DAMAGE_TYPE.ICE:
            {
                CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_ICE
                                                           , target._avatarController, -1);
            }
            break;

            case FC_DAMAGE_TYPE.THUNDER:
            {
                CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_THUNDER
                                                           , target._avatarController, -1);
            }
            break;

            default:
            {
                Assertion.Check(false, "now we do not support this type damage");
            }
            break;
            }
        }
    }