| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 | using System;using System.Collections;using System.Collections.Generic;using CombatLibrary.CombatLibrary.CombatCore;using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;using Fort23.Core;using UnityEngine;using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;public abstract class TimeLineEventLogicBasic : CObject{    public TimeLineAssetSerialization timeLineAssetSerialization    {        get { return mTimeLineAssetSerialization; }    }    protected TimeLineAssetSerialization mTimeLineAssetSerialization;    /// <summary>    /// 是否进入    /// </summary>    protected bool IsEnter;    protected bool IsLeave;    protected bool IsDis;    public ILifeCycle castEntity    {        get { return _castEntity; }    }    public ITimeLineTriggerEntity ITimeLineTriggerEntity    {        get { return _timeLineTriggerEntity; }    }    public TriggerData extraData    {        get { return _extraData; }        set { _extraData = value; }    }    /// <summary>    /// 施放者(谁施放的这个效果 (EntityBasic))    /// </summary>    protected ILifeCycle _castEntity;    /// <summary>    /// 触发者(谁触发的这个效果(skill))    /// </summary>    protected ITimeLineTriggerEntity _timeLineTriggerEntity;    protected BetterList<ILifetCycleHitPoint> currTarget;    protected TriggerData _extraData;    public int indexCount;    public Vector3[] customizePos    {        get { return _customizePos; }    }    protected Vector3[] _customizePos;    protected TimeLineEventLogicGroupBasic _timeLineEventLogicGroup;    public virtual bool IsFinish()    {        return true;    }    public virtual void CloseLoopFx()    {            }    public TimeLineEventLogicGroupBasic TimeLineEventLogicGroup    {        get { return _timeLineEventLogicGroup; }    }    public void InitEventLogic(TimeLineEventLogicGroupBasic timeLineEventLogicGroup,        TimeLineAssetSerialization timeLineAssetSerialization)    {        mTimeLineAssetSerialization = timeLineAssetSerialization;        this._timeLineEventLogicGroup = timeLineEventLogicGroup;    }    /// <summary>    /// timeline触发后持续更新    /// </summary>    /// <param name="time">当前时间线从执行到现在的时间</param>    public void TimeUpdate(float time)    {        if (time >= mTimeLineAssetSerialization.startTime)        {            if (!IsEnter)            {                IsEnter = true;                Enter();            }        }        ProTimeUpdate();        if (time >= mTimeLineAssetSerialization.endTime)        {            if (!IsLeave)            {                IsLeave = true;                Leave();            }        }    }    public override void ActiveObj()    {    }    /// <summary>    /// 休眠    /// </summary>    public override void DormancyObj()    {        // ProDispose();        Dispose();        ProDormancyObj();        mTimeLineAssetSerialization = null;        IsEnter = false;        IsLeave = false;        IsDis = false;        _castEntity = null;        _timeLineTriggerEntity = null;        _extraData = default;        currTarget = null;        _customizePos = null;        _timeLineEventLogicGroup = null;    }    protected virtual void ProDormancyObj()    {            }    protected void Enter()    {        ProEnter();    }    protected void Leave()    {        ProLeave();    }    public void Pause()    {        ProPause();    }    protected virtual void ProPause()    {    }    public void SetCombatInfo(ILifeCycle castEntity, ITimeLineTriggerEntity targetEntity,        BetterList<ILifetCycleHitPoint> currTarget,        TriggerData extraData,        Vector3[] customizePos,int indexCount)    {        this._castEntity = castEntity;        this._timeLineTriggerEntity = targetEntity;        this.currTarget = currTarget;        this._extraData = extraData;        this._customizePos = customizePos;        this.indexCount = indexCount;        ProSetCombatInfo();    }    ///// <summary>m    ///// 关闭FXinfo,隐藏掉改info创建并在使用的特效    ///// </summary>    public void BreakTimeLine()    {        if (currTarget != null)        {            currTarget.Clear();        }        ProBreakTimeLine();         }    public void Dispose()    {        if (IsDis)        {            return;        }        IsDis = true;        if (!IsLeave && IsEnter)        {            IsLeave = true;            Leave();        }        ProDispose();        this._timeLineTriggerEntity = null;        this._castEntity = null;        this.currTarget = null;        this._extraData = default;        this._customizePos = null;    }    public BetterList<ILifetCycleHitPoint> GetSkillTarget()    {        if (mTimeLineAssetSerialization.targetEntityType.HasFlag(FXTargetType.Oneself))        {            BetterList<ILifetCycleHitPoint> target = CombatListPool<ILifetCycleHitPoint>.Instance.Get();            target.Add(_castEntity.GetMainHotPoin<ILifetCycleHitPoint>(true));            return target;        }        else        {            if (currTarget != null && currTarget.Count > 0)            {                return FilterTargetForCombat(currTarget);            }            if (_timeLineTriggerEntity == null)            {                return new BetterList<ILifetCycleHitPoint>(1);            }            ITimeLineTargetEntity timeLineTargetEntity = _timeLineTriggerEntity as ITimeLineTargetEntity;            if (timeLineTargetEntity == null)            {                return new BetterList<ILifetCycleHitPoint>(1);            }            currTarget = CombatListPool<ILifetCycleHitPoint>.Instance.Get();            ILifetCycleHitPoint[] getTarget = timeLineTargetEntity.GetTineLineTargetEntity(this);            currTarget.AddRange(getTarget);            getTarget = currTarget.ToArray();            if ((int)mTimeLineAssetSerialization.targetEntityType != 2)            {                ILifetCycleHitPoint[] point =                    timeLineTargetEntity.FilterTarget(this, mTimeLineAssetSerialization.targetEntityType, getTarget);                currTarget.Clear();                currTarget.AddRange(point);            }            return FilterTargetForCombat(currTarget);        }    }    private BetterList<ILifetCycleHitPoint> FilterTargetForCombat(BetterList<ILifetCycleHitPoint> point)    {        ITimeLineTargetEntity timeLineTargetEntity = _timeLineTriggerEntity as ITimeLineTargetEntity;        if (timeLineTargetEntity == null)        {            return point;        }        ILifetCycleHitPoint[] lifetCycleHitPoints =            timeLineTargetEntity.FilterTargetForCombat(this, mTimeLineAssetSerialization.targetEntityType,                point.ToArray());        point.Clear();        point.AddRange(lifetCycleHitPoints);        return point;    }    protected abstract void ProSetCombatInfo();    protected abstract void ProEnter();    protected abstract void ProLeave();    protected abstract void ProTimeUpdate();    protected abstract void ProBreakTimeLine();    protected virtual void ProDispose()    {    }}
 |