Exemple #1
0
    /// <summary>
    /// 技能释放
    /// 判断释放方式
    /// 立即命中 - 检测技能范围内敌人,实施效果
    /// 飞行命中 - 创建飞行特效,追踪敌人,抵达敌人位置后,实施效果
    /// </summary>
    public void SkillRelease(int skillId, int eventId)
    {
        if (!mSkillDic.ContainsKey(skillId))
        {
            return;
        }

        Skill skill = mSkillDic[skillId];

        AnimatorSkillProperty mAnimator = skill.mSkillProperty.mAnimatorSkillProperty;

        if (!mAnimator.mSkillActionProperty.ContainsKey(eventId))
        {
            return;
        }

        SkillActionProperty skillActionProperty = mAnimator.mSkillActionProperty[eventId];

        if (skillActionProperty == null)
        {
            return;
        }

        if (skillActionProperty.mSkillReleaseType == SkillReleaseType.SkillReleaseType_Immediately)
        {
            SkillHit(skillActionProperty);
        }
        else if (skillActionProperty.mSkillReleaseType == SkillReleaseType.SkillReleaseType_Flying)
        {
            List <IObject> list = GetTargets(skillActionProperty);
            if (list == null || list.Count != 1)
            {
                return;
            }

            EffectManager.Instance.CreateFlyingEffect(mObj, skillActionProperty, list[0]);
        }
    }
Exemple #2
0
    public bool LoadAnimatorSkillProperty()
    {
        byte[] asset = ResourceManager.Instance.GetXml("AnimatorConfig");
        if (asset == null)
        {
            return(false);
        }

        TbXmlNode docNode = TbXml.Load(asset).docNode;

        if (docNode == null)
        {
            return(false);
        }

        List <TbXmlNode> xmlNodeList = docNode.GetNodes("animatorconfig/Property");
        int xmlNodeListLength        = xmlNodeList.Count;

        if (xmlNodeListLength < 1)
        {
            return(false);
        }

        for (int i = 0; i < xmlNodeListLength; ++i)
        {
            TbXmlNode             node = xmlNodeList[i] as TbXmlNode;
            AnimatorSkillProperty asp  = new AnimatorSkillProperty();
            asp.mySkillId            = node.GetIntValue("No");
            asp.mySkillAction        = node.GetIntValue("Action");
            asp.mSkillActionProperty = new Dictionary <int, SkillActionProperty>();

            List <TbXmlNode> childNode = node.GetNodes("Action");
            asp.mySkillActionCount = childNode.Count;

            for (int j = 0; j < asp.mySkillActionCount; ++j)
            {
                TbXmlNode           child = childNode[j] as TbXmlNode;
                SkillActionProperty sap   = new SkillActionProperty();

                sap.ActionNumberId = child.GetIntValue("ActionNumber");

                sap.mSkillTargetType  = (SkillTargetType)child.GetIntValue("TargetType");
                sap.mSkillReleaseType = (SkillReleaseType)child.GetIntValue("SkillReleaseType");
                sap.mSkillFlyRes      = child.GetStringValue("SkillFlyRes");

                sap.mSkillType = (SkillType)child.GetIntValue("SkillType");

                string skillTypeParams = child.GetStringValue("SkillTypeParams");
                if (skillTypeParams == null || skillTypeParams.Equals(""))
                {
                    sap.mSkillTypeParams = new List <float>();
                    sap.mSkillTypeParams.Add(1f);
                }
                else
                {
                    sap.mSkillTypeParams = new List <float>();
                    string[] s = skillTypeParams.Split(',');

                    for (int k = 0; k < s.Length; k++)
                    {
                        sap.mSkillTypeParams.Add(UtilTools.FloatParse(s[k]));
                    }
                }

                sap.mPauseTime      = UtilTools.FloatParse(child.GetStringValue("PauseTime"));
                sap.mCenterOffset   = UtilTools.FormatStringVector3(child.GetStringValue("CenterOffset"));
                sap.mSkillRangeType = (SkillRangeType)child.GetIntValue("SkillRangeType");

                string skillRangeTypeParams = child.GetStringValue("SkillRangeTypeParams");
                if (skillRangeTypeParams == null || skillRangeTypeParams.Equals(""))
                {
                    sap.mSkillRangParametr = null;
                }
                else
                {
                    sap.mSkillRangParametr = new List <float>();
                    string[] s = skillRangeTypeParams.Split(',');
                    for (int k = 0; k < s.Length; k++)
                    {
                        sap.mSkillRangParametr.Add(UtilTools.FloatParse(s[k]));
                    }
                }

                sap.mHurtEffectId = child.GetIntValue("HurtEffect");
                sap.mDamageStatus = child.GetIntValue("DamageStatus");
                sap.mDebuffId     = child.GetIntValue("DebuffId");

                sap.mAttackerPauseTime   = UtilTools.FloatParse(child.GetStringValue("AttackerPauseTime"));
                sap.mCameraShakeNumber   = child.GetIntValue("CameraShakeNumber");
                sap.mCameraShakeDistance = UtilTools.FloatParse(child.GetStringValue("CameraShakeDistance"));
                sap.mCameraShakeSpeed    = UtilTools.FloatParse(child.GetStringValue("CameraShakeSpeed"));
                sap.mRepelType           = child.GetIntValue("RepelType");
                sap.mHurtDir             = child.GetIntValue("HurtDir");
                sap.mShakeRotationX      = UtilTools.FloatParse(child.GetStringValue("RotationX"));
                sap.mShakeDecay          = UtilTools.FloatParse(child.GetStringValue("ShakeDecay"));
                sap.mTopplebackType      = child.GetIntValue("TopplebackType");

                asp.mSkillActionProperty.Add(sap.ActionNumberId, sap);
            }

            if (mSkillPropertyDic.ContainsKey(asp.mySkillId))
            {
                mSkillPropertyDic[asp.mySkillId].mAnimatorSkillProperty = asp;
            }
        }

        return(true);
    }