123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Fort23.Common;
- using Fort23.Core;
- using Fort23.UTool;
- using UnityEngine;
- using UnityEngine.Rendering;
- using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
- using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventLogic;
- public class GameTimeLineParticleFactory : ITimeLineParticleFactory
- {
- protected List<CombatParticleSystemPool> allCombatParticleSystem =
- new List<CombatParticleSystemPool>();
- public Clock CreateParticle(TimeLineEventParticleLogicBasic timeLineEventParticleLogicBasic,
- ILifetCycleHitPoint effectTarget,
- ILifetCycleHitPoint fxTarget, Vector3 startPos, SpecialDotInfo targetSpecialDotInfo,
- Action<IGObjectPoolInterface> callBack)
- {
- Clock clock = CreateParticle(timeLineEventParticleLogicBasic.timeLinePlayFxSerializtion.fxName, startPos,
- fxTarget,
- false, targetSpecialDotInfo, delegate(ParticleSystemPool combatParticleSystemPool)
- {
- CombatParticleSystemPool pool = combatParticleSystemPool as CombatParticleSystemPool;
- #if !COMBAT_SERVER
- pool.InitCombatParticleSystem();
- #endif
-
- if (targetSpecialDotInfo != null)
- {
- #if !COMBAT_SERVER
- // CombatHeroEntity heroEntity = targetSpecialDotInfo.heroEntity as CombatHeroEntity;
- // if (heroEntity.CombatHeroTransform.iGObjectPoolInterface == null)
- // {
- // return;
- // }
- #endif
- // if (!timeLineEventParticleLogicBasic.timeLinePlayFxSerializtion.isActivityCustomTargetPos)
- // {
- // startPos = targetSpecialDotInfo.GetWorlPos();
- // }
- #if !COMBAT_SERVER
- if (!timeLineEventParticleLogicBasic.timeLinePlayFxSerializtion.isNotRotate)
- {
- pool.transform.eulerAngles = targetSpecialDotInfo.GetEulerAngles();
- pool.isNotRotion = false;
- }
- else
- {
- pool.isNotRotion = true;
- }
- // if (heroEntity != null)
- // {
- // pool.transform.SetParent(heroEntity.CombatHeroTransform.iGObjectPoolInterface.own.transform);
- // }
- // else
- // {
- // pool.transform.SetParent(targetSpecialDotInfo.targetTran);
- // }
- #endif
- }
- else
- {
- }
- #if !COMBAT_SERVER
- pool.gameObject.SetActive(false);
- pool.transform.position = startPos;
- if (timeLineEventParticleLogicBasic.timeLinePlayFxSerializtion.isFollowTarget &&
- timeLineEventParticleLogicBasic.timeLinePlayFxSerializtion.locationType !=
- FXLocationType.SceneZero)
- {
- pool.transform.localEulerAngles = Vector3.zero;
- pool.targetSpecialDotInfo = targetSpecialDotInfo;
- }
- else
- {
- // pool.transform.SetParent(null);
- pool.targetSpecialDotInfo = null;
- }
- #endif
- // if (fxAiDataBasic != null)
- // {
- // if (CombatManager.Instance.currFrame != initFrame)
- // {
- // LogTool.Error(
- // $"战斗中特效没有预加载 {CombatManager.Instance.currFrame - initFrame} {timeLineEventParticleLogicBasic.timeLinePlayFxSerializtion.fxName}");
- // }
- //
- // FxAILogicBasic fxAILogicBasic = CreateFxAILogicBasic(fxAiDataBasic);
- // if (fxAILogicBasic != null)
- // {
- // if (!allFxAiLogicBasic.Contains(fxAILogicBasic))
- // {
- // allFxAiLogicBasic.Add(fxAILogicBasic);
- // }
- //
- // fxAILogicBasic.SetAIMonoObj(combatParticleSystemPool);
- // fxAILogicBasic.Init(startPos, fxAiDataBasic, timeLineEventParticleLogicBasic, effectTarget,
- // targetSpecialDotInfo);
- // }
- // }
- #if !COMBAT_SERVER
- pool.gameObject.SetActive(true);
- #endif
- callBack?.Invoke(combatParticleSystemPool);
- });
- return clock;
- }
- public Clock CreateParticle(string fxName, Vector3 startPos, ILifetCycleHitPoint fxTarget, bool isRotate,
- SpecialDotInfo targetSpecialDotInfo, Action<ParticleSystemPool> callBack, bool isNotLoadFx = false)
- {
- #if !COMBAT_SERVER
- Clock clock = ClockPool.GetClock();
-
-
- CTask<CombatParticleSystemPool> task = GObjectPool.Instance.FetchAsync(fxName + ".prefab",
- delegate(CombatParticleSystemPool pool)
- {
- if (pool == null)
- {
- return;
- }
- // if (!isActive)
- // {
- // GObjectPool.Instance.RecycleForDestroy(pool);
- // return;
- // }
- if (!allCombatParticleSystem.Contains(pool))
- {
- allCombatParticleSystem.Add(pool);
- }
- else
- {
- LogTool.Error("添加重复");
- }
- //
- // if (targetSpecialDotInfo != null && targetSpecialDotInfo.rootTrnsform != null)
- // {
- // SortingGroup sortingGroup = targetSpecialDotInfo.rootTrnsform.GetSortingGroup();
- // if (sortingGroup != null)
- // {
- // pool.SetRootSortingGroup(sortingGroup);
- // }
- // else
- // {
- // pool.SetOder(0, "Hero");
- // }
- // }
- // else
- // {
- // pool.SetOder(10000, "Hero");
- // }
- if (isRotate && fxTarget != null)
- {
- SpecialDotInfo specialDotInfo = fxTarget.GetSpecialDotInfo(null);
- if (specialDotInfo != null)
- {
- pool.transform.eulerAngles = specialDotInfo.GetEulerAngles();
- }
- }
- float size = 1;
- // if (fxTarget != null)
- // {
- // CombatHeroEntity combatHeroEntity = fxTarget.IfLifeCycle.This<CombatHeroEntity>();
- // if (combatHeroEntity != null)
- // {
- // HeroGameObjectConfig heroGameObjectConfig =
- // combatHeroEntity.HeroGameObjectConfig;
- // if (heroGameObjectConfig != null)
- // {
- // size = heroGameObjectConfig.size;
- // }
- // }
- // }
- pool.SetSize(size);
- pool.own.transform.position = startPos;
- callBack?.Invoke(pool);
- }, clock);
- return clock;
- #else
- callBack?.Invoke(new CombatParticleSystemPool());
- return null;
- #endif
- }
- }
|