| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 | using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;using Core.Utility;using UnityEngine;using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventLogic;namespace GameLogic.Combat.Skill.MagicSkill{    public class XiaoShiAndShow : MagicAttShowBasic    {        private Vector3 currSize;        private Vector3 targetSize;        private Vector3 currPos;        private Vector3 targetPos;        private float currTime;        private float moveSpeed = 5;        protected bool isUpdateMove;        protected float showSizeTime;        protected int state;        private BesselPath _besselPathA;        protected override void ProInit()        {        }        protected override void ProSetInfo()        {            isUpdateMove = false;            int odds = UnityEngine.Random.Range(0, 100);            // if (odds < 1)            {                state = 0;                TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic =                    _skillBasic.ActivationTimeLineData("sk1_xiaoshi");                timeLineEventLogicGroupBasic.TimeLineUpdateEnd = XiaoShiFinish;            }            // else            // {            //     state = 1;            //     // Vector3 p1 =            //     //     _skillBasic.CombatHeroEntity.GameObject.transform.TransformPoint(new Vector3(-5f, 5f, 5f));            //     // Vector3 p2 = SetTargetPos2();            //     // _besselPathA.controlPoints.Add(_skillBasic.CombatHeroEntity.GameObject.transform.position);            //     // _besselPathA.controlPoints.Add(p1);            //     // _besselPathA.controlPoints.Add(p2);            //     // _besselPathA.controlPoints.Add(target.dotPos);            //     //            //                 //     _besselPathA = new BesselPath();            //     _besselPathA.controlPoints.Add(CombatHeroEntity.dotPos);            //     _besselPathA.controlPoints.Add(            //         CombatHeroEntity.GameObject.transform.TransformPoint(new Vector3(-5f, 5f, 5f)));            //            //     _besselPathA.controlPoints.Add(target.GameObject.transform.TransformPoint(new Vector3(-5f, 6f, 5f)));            //     Vector3 headPos = target.dotPos + new Vector3(0, 5, 0);            //     _besselPathA.controlPoints.Add(headPos);            //     currTime = 0;            //     isUpdateMove = true;            // }        }        private void XiaoShiFinish()        {            TimeLineMagicWeaponShowPointSerializtion timeLineMagicWeaponShowPointSerializtion = CombatHeroEntity                .combatHeroTimeLineControl                .GetTimeLineEventInfo<TimeLineMagicWeaponShowPointSerializtion>("sk1_show");            if (timeLineMagicWeaponShowPointSerializtion != null)            {                switch (timeLineMagicWeaponShowPointSerializtion.showPointType)                {                    case TimeLineMagicWeaponShowPointSerializtion.ShowPointType.Head:                        Vector3 headPos = target.dotPos + new Vector3(0, 6, 0);                        CombatHeroEntity.combatHeroGameObject.SetPosition(headPos);                        break;                    case TimeLineMagicWeaponShowPointSerializtion.ShowPointType.Customize:                        SpecialDotInfo specialDotInfo =                            target.GetSpecialDotInfo(timeLineMagicWeaponShowPointSerializtion.customizePointName);                        CombatHeroEntity.combatHeroGameObject.SetPosition(specialDotInfo.GetWorlPos());                        break;                }            }            else            {                Vector3 headPos = target.dotPos + new Vector3(0, 6, 0);                CombatHeroEntity.combatHeroGameObject.SetPosition(headPos);            }            CombatHeroEntity.combatHeroGameObject.SetScale(new Vector3(2, 2, 2));            CombatHeroEntity.GameObject.transform.eulerAngles =                new Vector3(0, target.GameObject.transform.eulerAngles.y + 180, 0);            TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic =                _skillBasic.ActivationTimeLineData("sk1_show");            timeLineEventLogicGroupBasic.TimeLineUpdateEnd = ShowFinish;        }        private void ShowFinish()        {            TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic =                _skillBasic.ActivationTimeLineData("sk1");            if (timeLineEventLogicGroupBasic != null) //有表现.播表现,不需要位移            {                timeLineEventLogicGroupBasic.TimeLineUpdateEnd = AllFinish;            }            else //位移            {                showSizeTime = 0;                currSize = Vector3.one;                targetSize = Vector3.one * 2f;                currPos = CombatHeroEntity.dotPos;                targetPos = target.dotPos;                currTime = 0;                isUpdateMove = true;                state = 3;            }        }        private void AllFinish()        {            TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic =                _skillBasic.ActivationTimeLineData("sk1_hit");            callBack?.Invoke();        }        protected override void ProUpdate(float t)        {            if (!isUpdateMove)            {                return;            }            if (state == 1)            {                currTime += t * 0.5f;                Vector3 a1 = _besselPathA.CalculatePoint(currTime);                Vector3 a2 = _besselPathA.CalculatePoint(currTime - 0.01f);                CombatHeroEntity.combatHeroGameObject.SetPosition(a1);                CombatHeroEntity.GameObject.transform.rotation = Quaternion.LookRotation((a1 - a2).normalized);                if (currTime > 1)                {                    isUpdateMove = false;                    CombatHeroEntity.combatHeroGameObject.SetScale(new Vector3(3, 3, 3));                    CombatHeroEntity.GameObject.transform.eulerAngles =                        new Vector3(0, target.GameObject.transform.eulerAngles.y + 180, 0);                    ShowFinish();                }            }            else   if (state == 3)            {                currTime += t * moveSpeed;                // Vector3 size = Vector3.Lerp(currSize, targetSize, currTime);                Vector3 pos = Vector3.Lerp(currPos, targetPos, currTime);                CombatHeroEntity.combatHeroGameObject.SetPosition(pos);                // CombatHeroEntity.combatHeroGameObject.SetScale(size);                if (currTime > 1)                {                    isUpdateMove = false;                    AllFinish();                }            }        }    }}
 |