Exemplo n.º 1
0
        public static void OnRoleAtk(FrameEventInfo.RoleAtkFrameEventData roleAtkFrameEventData
                                     , string id
                                     , string damageId
                                     , string teamId
                                     , SkeletonRenderer skeletonRenderer
                                     , ITriggerDelegate triggerDelegate
                                     , Vector3 rotation

                                     , DamageEffectType baseDamageEffectType = DamageEffectType.Strike
                                     , AtkPropertyType baseAtkPropertyType   = AtkPropertyType.physicalDamage
                                     , float baseAtk         = 0
                                     , float baseAtkMin      = 0
                                     , float baseAtkMax      = 0
                                     , float baseMagicAtkMin = 0
                                     , float baseMagicAtkMax = 0
                                     , float basePoiseCut    = 0
                                     , float baseMass        = 0
                                     , float criticalRate    = 0
                                     , float criticalAtk     = 1
                                     , Action <DamageController> onAddDamageController = null)
        {
            if (roleAtkFrameEventData == null)
            {
                Debug.LogWarning(roleAtkFrameEventData == null);
                return;
            }

            if (roleAtkFrameEventData.type == FrameEventInfo.RoleAtkFrameEventData.Type.Default ||
                roleAtkFrameEventData.type == FrameEventInfo.RoleAtkFrameEventData.Type.Add)
            {
                if (roleAtkFrameEventData.bindType == FrameEventInfo.RoleAtkFrameEventData.BindType.Default)
                {
                    DamageController damageController = RoleAtk(triggerDelegate, id, damageId, teamId,
                                                                roleAtkFrameEventData.parentType, roleAtkFrameEventData.primitiveType, roleAtkFrameEventData.pos, roleAtkFrameEventData.size,
                                                                rotation, roleAtkFrameEventData.hitType, roleAtkFrameEventData.targetMoveBy,
                                                                roleAtkFrameEventData.DamageDirectionType,
                                                                roleAtkFrameEventData.SpecialEffectOnOff
                            ? roleAtkFrameEventData.damageEffectType
                            : baseDamageEffectType
                                                                , roleAtkFrameEventData.atkPropertyTypeOnOff
                            ? roleAtkFrameEventData.atkPropertyType
                            : baseAtkPropertyType
                                                                , roleAtkFrameEventData.atk
                                                                , roleAtkFrameEventData.poiseCut
                                                                , baseAtk
                                                                , baseAtkMin
                                                                , baseAtkMax
                                                                , baseMagicAtkMin
                                                                , baseMagicAtkMax
                                                                , basePoiseCut
                                                                , baseMass
                                                                , criticalRate
                                                                , criticalAtk
                                                                );

                    if (roleAtkFrameEventData.type == FrameEventInfo.RoleAtkFrameEventData.Type.Add)
                    {
                        damageController.SetId(id);
                    }
                    else
                    {
                        damageController.SetId(id);
                        damageController.SetDestroyTime(0.1f);
                    }

                    // 破盾 add by TangJian 2019/4/3 17:00
                    damageController.SetBreakShiled(roleAtkFrameEventData.breakShield);
                    damageController.SetIgnoreShiled(roleAtkFrameEventData.ignoreShield);

                    if (onAddDamageController != null)
                    {
                        onAddDamageController(damageController);
                    }
                }
                else if (roleAtkFrameEventData.bindType == FrameEventInfo.RoleAtkFrameEventData.BindType.BindAnimSlot)
                {
                    foreach (var slotName in roleAtkFrameEventData.slotList)
                    {
                        DamageController damageController = RoleAtk(triggerDelegate, id, damageId, teamId,
                                                                    roleAtkFrameEventData.parentType, roleAtkFrameEventData.primitiveType, roleAtkFrameEventData.pos, roleAtkFrameEventData.size,
                                                                    rotation, roleAtkFrameEventData.hitType, roleAtkFrameEventData.targetMoveBy,
                                                                    roleAtkFrameEventData.DamageDirectionType,
                                                                    roleAtkFrameEventData.SpecialEffectOnOff
                                ? roleAtkFrameEventData.damageEffectType
                                : baseDamageEffectType
                                                                    , roleAtkFrameEventData.atkPropertyTypeOnOff
                                ? roleAtkFrameEventData.atkPropertyType
                                : baseAtkPropertyType
                                                                    , roleAtkFrameEventData.atk
                                                                    , roleAtkFrameEventData.poiseCut
                                                                    , baseAtk
                                                                    , baseAtkMin
                                                                    , baseAtkMax
                                                                    , baseMagicAtkMin
                                                                    , baseMagicAtkMax
                                                                    , basePoiseCut
                                                                    , baseMass
                                                                    );

                        // 伤害绑定slot add by TangJian 2018/12/5 17:14
                        damageController.bindType             = FrameEventInfo.RoleAtkFrameEventData.BindType.BindAnimSlot;
                        damageController.bindSkeletonRenderer = skeletonRenderer;
                        damageController.bindSlotName         = slotName;

                        if (roleAtkFrameEventData.type == FrameEventInfo.RoleAtkFrameEventData.Type.Add)
                        {
                            damageController.SetId(id);
                        }
                        else
                        {
                            damageController.SetId(id);
                            damageController.SetDestroyTime(0.1f);
                        }

                        // 破盾 add by TangJian 2019/4/3 17:00
                        damageController.SetBreakShiled(roleAtkFrameEventData.breakShield);
                        damageController.SetIgnoreShiled(roleAtkFrameEventData.ignoreShield);

                        if (onAddDamageController != null)
                        {
                            onAddDamageController(damageController);
                        }
                    }
                }
            }
            else if (roleAtkFrameEventData.type == FrameEventInfo.RoleAtkFrameEventData.Type.Remove)
            {
                DamageManager.Instance.Remove(id);
            }
        }