123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- using System.Collections;
- using System.Collections.Generic;
- using Common.Utility.CombatTimer;
- using Fort23.Core;
- #if !COMBAT_SERVER
- using Fort23.Core;
- #endif
- using Fort23.UTool;
- using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
- #if !COMBAT_SERVER
- using UnityEngine;
- #endif
- namespace UTool.CustomizeTimeLogic.FxLogic.TimeLineEventLogic
- {
- public class TimeLineEventParticleLogicBasic : TimeLineEventLogicBasic
- {
- // private Timer timer;
- private List<Clock> loadTask = new List<Clock>();
- public List<ParticleSystemPool> loopFx = new List<ParticleSystemPool>();
- private CombatTimer _combatTimer;
- public TimeLinePlayFxSerializtion timeLinePlayFxSerializtion
- {
- get { return mTimeLineAssetSerialization as TimeLinePlayFxSerializtion; }
- }
- protected override void ProSetCombatInfo()
- {
- }
- protected override void ProEnter()
- {
- // ITimeLineTriggerEvent trigger = _targetEntity as ITimeLineTriggerEvent;
- // if (trigger != null)
- {
- BetterList<ILifetCycleHitPoint> timeLineEntities = GetSkillTarget();
- ExecuteFxTarget(timeLineEntities, 0);
- }
- }
- protected override void ProLeave()
- {
- }
- protected override void ProTimeUpdate()
- {
- }
- protected override void ProBreakTimeLine()
- {
-
- for (int i = 0; i < loadTask.Count; i++)
- {
- loadTask[i].Dispose();
- }
- CombatTimerManager.Instance.RemoveTimer(_combatTimer);
- _combatTimer = null;
- CloseLoopFx();
- loadTask.Clear();
- }
- public void CloseLoopFx()
- {
- for (int i = 0; i < loopFx.Count; i++)
- {
- GObjectPool.Instance.Recycle(loopFx[i]);
- }
- loopFx.Clear();
- }
- protected override void ProDispose()
- {
- for (int i = 0; i < loadTask.Count; i++)
- {
- loadTask[i].Dispose();
- }
- CombatTimerManager.Instance.RemoveTimer(_combatTimer);
- _combatTimer = null;
- loadTask.Clear();
- if (currTarget != null)
- {
- currTarget.Dispose();
- }
- currTarget = null;
- }
- private void ExecuteFxTarget(BetterList<ILifetCycleHitPoint> combatTarget, int index)
- {
- if (combatTarget.Count <= index)
- {
- return;
- }
- ILifetCycleHitPoint lifeCycle = combatTarget[index];
- if (lifeCycle == null)
- {
- LogTool.Log("一个空的目标");
- index++;
- ExecuteFxTarget(combatTarget, index);
- return;
- }
- if (!string.IsNullOrEmpty(timeLinePlayFxSerializtion.fxName))
- {
- ILifetCycleHitPoint fxTarget = null;
- Vector3 startPos = Vector3.one;
- SpecialDotInfo targetSpecialDotInfo = null;
- switch (timeLinePlayFxSerializtion.locationType)
- {
- case FXLocationType.Oneself:
- fxTarget = _castEntity.GetMainHotPoin<ILifetCycleHitPoint>(true);
- break;
- case FXLocationType.Target:
- fxTarget = lifeCycle;
- break;
- case FXLocationType.CustomTarget:
- fxTarget = lifeCycle;
- break;
- case FXLocationType.SceneZero:
- fxTarget = _castEntity.GetMainHotPoin<ILifetCycleHitPoint>(false);
- startPos = TimeLineEventLogicGroup.SceneWorldPos();
- break;
- case FXLocationType.OneselfSpecialDot:
- fxTarget = _castEntity.GetMainHotPoin<ILifetCycleHitPoint>(false);
- break;
- case FXLocationType.TargetSpecialDot:
- fxTarget = lifeCycle;
- break;
- }
- if (fxTarget != null)
- {
- if (!string.IsNullOrEmpty(timeLinePlayFxSerializtion.hitPointGroupName))
- {
- ILifetCycleHitPoint newHitPoint =
- fxTarget.IfLifeCycle.GetILifetCycleHitPoint<ILifetCycleHitPoint>(
- timeLinePlayFxSerializtion.hitPointGroupName, true,true);
- targetSpecialDotInfo =
- newHitPoint.GetSpecialDotInfo(timeLinePlayFxSerializtion.targetSpecialDotName);
- }
- else
- {
- targetSpecialDotInfo =
- fxTarget.GetSpecialDotInfo(timeLinePlayFxSerializtion.targetSpecialDotName);
- }
- }
- if (timeLinePlayFxSerializtion.isActivityCustomTargetPos&&customizePos!=null&&customizePos.Length>timeLinePlayFxSerializtion.CustomTargetPosIndex)
- {
- startPos = customizePos[timeLinePlayFxSerializtion.CustomTargetPosIndex];
- targetSpecialDotInfo = null;
- }
- else if (targetSpecialDotInfo != null&&timeLinePlayFxSerializtion.locationType!=FXLocationType.SceneZero)
- {
- startPos = targetSpecialDotInfo.GetWorlPos();
- }
- if (timeLinePlayFxSerializtion.isGround)
- {
- startPos = new Vector3(startPos.x, (float) 0.7f);
- }
- LoadFx(lifeCycle, fxTarget, startPos,targetSpecialDotInfo);
- }
- index++;
- if (timeLinePlayFxSerializtion.intervalTime > 0)
- {
- _combatTimer = CombatTimerManager.Instance.AddTimer((float)timeLinePlayFxSerializtion.intervalTime*index,
- delegate { });
- ExecuteFxTarget(combatTarget, index);
- }
- else
- {
- ExecuteFxTarget(combatTarget, index);
- }
- }
- protected void LoadFx(ILifetCycleHitPoint effectTarget, ILifetCycleHitPoint fxTarget, Vector3 startPos,
- SpecialDotInfo targetSpecialDotInfo)
- {
-
- ITimeLineParticleFactory iTimeLineParticleFactory = TimeLineFxParticleTool.Instance.TimeLineFxParticleFactory;
- if (iTimeLineParticleFactory != null)
- {
- Clock clock = iTimeLineParticleFactory.CreateParticle(this, effectTarget, fxTarget, startPos,targetSpecialDotInfo,
- delegate(IGObjectPoolInterface systemPool)
- {
- ParticleSystemPool pool = systemPool as ParticleSystemPool;
- if (pool != null)
- {
- if (IsDis)
- {
- GObjectPool.Instance.Recycle(pool);
- return;
- }
- if (timeLinePlayFxSerializtion.isLoop)
- {
- loopFx.Add(pool);
- }
- if (timeLinePlayFxSerializtion.isAttSpeed)
- {
- ITimeLineParticlePlaySpeed timeLineParticlePlaySpeed =
- _castEntity as ITimeLineParticlePlaySpeed;
- #if !COMBAT_SERVER
- pool.palySpeed = timeLineParticlePlaySpeed.GetCurrPlaySpeed(timeLinePlayFxSerializtion);
- #endif
- }
- else
- {
- #if !COMBAT_SERVER
- pool.palySpeed = (float) 1;
- #endif
- }
- _timeLineEventLogicGroup.OnInitParticleSystemPoolCallBack?.Invoke(pool);
- }
- });
- if (clock != null)
- {
- loadTask.Add(clock);
- }
- }
- }
- }
- }
|