Ejemplo n.º 1
0
    public AbilityResultInfo(AbilityInstance _instance, st.net.NetBase.skill_effect _result)
    {
        DefResultType type     = (DefResultType)_result.def_sort;
        bool          isNoKick = type == DefResultType.DEF_SORT_NOSTIFLE || type == DefResultType.DEF_SORT_NOKICKDOWN || type == DefResultType.DEF_SORT_NOKICK;

        hasShowDamage = 0;
        instance      = _instance;
        result        = _result;
        startTime     = Time.time;
        SkillPerformanceRef refData = _instance.PerformanceRef;

        if (refData != null)
        {
            damageTimeList = refData.damageTimeList;
            damageRateList = refData.damageRateList;
            totalDamage    = _result.demage;
            Vector3 dest = new Vector3(_result.effect_x, _result.effect_y, _result.effect_z);


            Actor tar = GameCenter.curGameStage.GetInterActiveObj((int)_result.target_id) as Actor;
            if (tar != null)
            {
                switch (_instance.CurClientShowType)
                {
                case ClientShowType.Lightingskill:
                case ClientShowType.Invinciblechop:
                    _instance.PushTarTransform(tar.HitPoint);
                    break;
                }
            }
            if (dest != Vector3.zero || refData.kickTimes > 0)
            {
                if (instance.TargetActor == null)
                {
                    if (tar != null)
                    {
                        target = tar;
                    }
                }
                else
                {
                    if (refData.kickTimes > 0 && !isNoKick)
                    {
                        instance.TargetActor.StopMovingTo();
                    }
                    target = instance.TargetActor;
                }
            }

            if (dest != Vector3.zero)
            {
                Vector3 from     = target.transform.position;
                float   distance = Vector3.Distance(from, dest);
                dir = (dest - from).normalized;
                if (refData.kickDisSectionList.Count > 0)
                {
                    float rate = 0;
                    for (int i = 0; i < refData.kickDisSectionList.Count; i++)
                    {
                        rate += refData.kickDisSectionList[i];
                        moveList.Add(from + dir * (distance * rate));
                        moveTimes.Add(refData.kickShowTimes * refData.kickDisSectionList[i]);
                        float rigiFloat = 0;
                        for (int j = i; j < refData.kickDisSectionList.Count; j++)
                        {
                            rigiFloat += refData.kickDisSectionList[j];
                        }
                        rigidityTimes.Add(refData.kickTimes * rigiFloat);
                        moveFlag.Add(refData.kickDisSectionList[i] > 0);
                    }
                }
                else
                {
                    moveList.Add(dest);
                    moveTimes.Add(refData.kickShowTimes);
                    rigidityTimes.Add(refData.kickTimes);
                    moveFlag.Add(false);
                }
            }
            if (refData.kickTimes > 0 && target != null && !isNoKick)
            {
                SmartActor sa = target as SmartActor;
                if (sa != null)
                {
                    sa.StopMovingTo();
                }
            }

            if (refData.damageRateList.Count > 0)
            {
                for (int i = 0; i < refData.damageRateList.Count; i++)
                {
                    int singleDamage = Mathf.RoundToInt(totalDamage * (damageRateList[i] / 100.0f));
                    damageList.Add((ulong)singleDamage);
                }
            }
            else
            {
                damageList.Add(totalDamage);
            }
            hitEffectList     = refData.hitEffectList;
            hitEffectTimeList = refData.hitEffectTimeList;
            hitSoundList      = refData.soundDefRes;



            int animCount = Mathf.Max(1, damageTimeList.Count);
            switch ((DefResultType)_result.def_sort)
            {
            case DefResultType.DEF_SORT_NO:
                for (int i = 0; i < animCount; i++)
                {
                    hitAnimList.Add("hit");
                }
                break;

            case DefResultType.DEF_SORT_TREAT:
                break;

            //case DefResultType.DEF_SORT_DIE:
            //    for (int i = 0; i < animCount; i++)
            //    {
            //        hitAnimList.Add("hit");
            //    }
            //    break;
            case DefResultType.DEF_SORT_STIFLE:
                for (int i = 0; i < animCount; i++)
                {
                    hitAnimList.Add("hit");
                }
                break;

            case DefResultType.DEF_SORT_KICK2:
                for (int i = 0; i < animCount; i++)
                {
                    hitAnimList.Add("kickdown");
                }
                break;

            case DefResultType.DEF_SORT_KICK:
                for (int i = 0; i < animCount; i++)
                {
                    hitAnimList.Add("kickfly");
                }
                break;

            case DefResultType.DEF_SORT_UNTREAT:
                break;

            case DefResultType.DEF_SORT_NOKICKDOWN:
                break;

            case DefResultType.DEF_SORT_NOSTIFLE:
                break;

            case DefResultType.DEF_SORT_NOKICK:
                break;

            default:
                break;
            }
            //如果是脚本技能,在经过后台确认后,直接播放声音队列 by吴江
            if (_instance.thisSkillMode == SkillMode.SCRIPTSKILL)
            {
                GameCenter.soundMng.PlaySkillSoundList(refData.soundAtkRes);
            }
        }
    }