| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 | using System;using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;using Core.Audio;using Core.Triiger;using Fort23.Common;using Fort23.Core;using Fort23.UTool;using GameLogic.Combat.CombatTool;using GameLogic.Combat.Hero;using GameLogic.Combat.Skill;#if !COMBAT_SERVERusing UnityEngine;#endifusing UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventLogic;namespace Common.Combat.FxAILogic{    public abstract class FxAILogicBasic : MonoBehaviour, IDisposable, ITimelineFxLogic, ITriggerEntity    {        [Header("移动的根节点,默认是root")] public GameObject moveTarget;        private TimeLineEventParticleLogicBasic _timeLineEventParticleLogicBasic;        private ILifetCycleHitPoint _attTarget;        public SkillFeaturesData SkillFeaturesData;        [Header("延迟时间发射")] public float delayTime;        [Header("多目标时延迟")] public float multipleTargetDelayTime;        [Header("碰撞时的特效")] public string hitFxName;        [Header("开始飞行的音效")] public string startAudioName;        [Header("碰撞音效")] public string hitAudioName;        [Header("对碰时播放的特效")] public string pengZhuangHitFxName;        public BarrierTriggerData BarrierTriggerData;        /// <summary>        /// 额外移动速度 <0 减速 >0加速        /// </summary>        [HideInInspector] public float extraMoveSpeed;        /// <summary>        /// 不能移动        /// </summary>        public bool isNotMove;        public ILifetCycleHitPoint AttTarget        {            get { return _attTarget; }        }        public CombatHeroEntity CombatHeroEntity        {            get { return _combatHeroEntity; }        }        private CombatHeroEntity _combatHeroEntity;        public TimeLineEventParticleLogicBasic TimeLineEventParticleLogicBasic        {            get { return _timeLineEventParticleLogicBasic; }        }        public IGObjectPoolInterface ObjectPoolInterface;        [Header("是否可以穿透")] public bool isPenetrate;        [Header("是否使用自定义目标结束点")] public bool isUseCustomTargetEndPos;        [Header("结束点的下标")] public int customTargetEndPosIndex;        /// <summary>        /// 开始点        /// </summary>        protected Vector3 startPos;        public float size = 1;        public Vector3 CurrPos        {            get { return _currPos; }        }        /// <summary>        /// 当前Obj的位置        /// </summary>        protected Vector3 _currPos;        protected Vector3 rotation;        protected SpecialDotInfo specialDotInfo;        protected float currTime;        public TriggerData triggerData;        protected bool isNotCanTriggerGround;        protected bool _isUpdateBasic;        private float _currDelayTime;        private float _currAllDelayTime;        public bool isInit = false;        private bool isPlayStartAudio = false;        public void Init(Vector3 startPos,            TimeLineEventParticleLogicBasic timeLineEventParticleLogicBasic, ILifetCycleHitPoint attTarget,            SpecialDotInfo specialDotInfo = null)        {            if (timeLineEventParticleLogicBasic.castEntity == null)            {                Dispose();                return;            }            isPlayStartAudio = false;            if (moveTarget == null)            {                moveTarget = ObjectPoolInterface.own;            }            ObjectPoolInterface.own.SetActive(false);            BarrierTriggerData = new BarrierTriggerData();            isNotMove = false;            extraMoveSpeed = 0;            size = 1;            _currAllDelayTime = delayTime + timeLineEventParticleLogicBasic.indexCount * multipleTargetDelayTime;            _currDelayTime = 0;            _currPos = startPos;            this.startPos = startPos;            this._timeLineEventParticleLogicBasic = timeLineEventParticleLogicBasic;            this._attTarget = attTarget;            _combatHeroEntity = timeLineEventParticleLogicBasic.castEntity.This<CombatHeroEntity>();            this.specialDotInfo = specialDotInfo;            ITimeLineTriggerEvent trigger =                timeLineEventParticleLogicBasic.ITimeLineTriggerEntity as ITimeLineTriggerEvent;            if (trigger != null)            {                trigger.TimelineFxLogicInit(timeLineEventParticleLogicBasic.timeLinePlayFxSerializtion.groupName, this,                    triggerData);                SkillBasic skillBasic = trigger as SkillBasic;                SkillFeaturesData = skillBasic.GetSkillFeaturesData();                SkillFeaturesData.FxAILogicBasic = this;            }            triggerData = timeLineEventParticleLogicBasic.extraData;            triggerData.TrggerObject = this;            currTime = 0;            _isUpdateBasic = true;            ObjectPoolInterface.own.transform.localScale = Vector3.one * size;            ProInit();            isInit = true;            ObjectPoolInterface.own.SetActive(true);        }        public void SetAIMonoObj(IGObjectPoolInterface poolInterface)        {            this.ObjectPoolInterface = poolInterface;        }        /// <summary>        /// 扣除技能强度        /// </summary>        public void DeductSkillStrength(long hp)        {                    }        // private void Detection()        // {        //     if (_updateCount % 2 != 0)        //     {        //         return;        //     }        //        //     ProDetection();        // }        //        // protected virtual void ProDetection()        // {        // }        public void PlayHit()        {            FinishHit(CurrPos, hitFxName);        }        public void PlayPengZhuangHit()        {            FinishHit(CurrPos, pengZhuangHitFxName);        }        protected void FinishHit(Vector3 pos, string hitFxName)        {            if (!string.IsNullOrEmpty(hitFxName))            {                CombatController.currActiveCombat.GameTimeLineParticleFactory.CreateParticle(hitFxName,                    pos, null, false, null, null);            }        }        protected void Hit(string fxName, Vector3 startPos, ILifetCycleHitPoint fxTarget, bool isRotate,            SpecialDotInfo targetSpecialDotInfo)        {            if (string.IsNullOrEmpty(fxName))            {                return;            }            TimeLineFxParticleTool.Instance.TimeLineFxParticleFactory.CreateParticle(fxName, startPos, fxTarget,                isRotate,                targetSpecialDotInfo, delegate(ParticleSystemPool pool)                {#if !COMBAT_SERVER                    // if (ObjectPoolInterface != null&&pool.own!=null)                    // {                    //     FxColorAlter colorAlter = ObjectPoolInterface.own.GetComponent<FxColorAlter>();                    //     if (colorAlter != null)                    //     {                    //         FxColorAlter colorAlter2 = pool.own.GetComponent<FxColorAlter>();                    //         if (colorAlter2 == null)                    //         {                    //             colorAlter2 = pool.own.AddComponent<FxColorAlter>();                    //         }                    //                    //         colorAlter2.AlterColor(colorAlter.currValue);                    //     }                    // }#endif                });        }        public virtual void CombatUpdate(float time)        {            if (!_isUpdateBasic)            {                return;            }            _currDelayTime += time;            if (_currDelayTime < _currAllDelayTime)            {                return;            }            if (!isPlayStartAudio)            {                isPlayStartAudio = true;                if (!string.IsNullOrEmpty(startAudioName))                {                    AudioManager.Instance.Play(startAudioName,false);                }            }            ProCombatUpdate(time);            if (_timeLineEventParticleLogicBasic == null)            {                return;            }            // Detection();            UnityRenderUpdate(time);        }        public void UnityRenderUpdate(float time)        {            ProUnityRenderUpdate(time);        }        public void Dispose()        {            if (_timeLineEventParticleLogicBasic == null)            {                return;            }            isInit = false;            isNotMove = false;            GObjectPool.Instance.Recycle(ObjectPoolInterface);            CombatController.currActiveCombat.GameTimeLineParticleFactory.RemoveFxAILogicBasic(this);            ProDispose();            // timeLineEventParticleLogicBasic?.Dispose();            ObjectPoolInterface = null;            _timeLineEventParticleLogicBasic = null;            _attTarget = null;            ObjectPoolInterface = null;            // _fxAiDataBasic = null;            _isUpdateBasic = false;            // UnityRenderUpdateComponent.Instance.RemoveICombatUpdate(this);            // CombatFactoryTool.Instance.Recycle(scName, this);        }        protected virtual void ProInit()        {        }        protected virtual void ProCombatUpdate(float time)        {        }        protected virtual void ProUnityRenderUpdate(float time)        {        }        protected virtual void ProDispose()        {        }    }}
 |