using Core.Utility; using Fort23.Core; using Fort23.UTool; using UnityEngine; namespace Fort23.Mono { public class UseSkillShowFxMono : CObject { protected BesselPathGroup besselPathGroup; protected ParticleSystemPool gObjectPoolInterface; protected float _currTime; protected float _timeAdd; private float _speed = 0.5f; private ParticleSystemPool particleSystemEnd; private ParticleSystemPool particleSystemTar; private bool isEnd; public void Init(BesselPathGroup besselPathGroup, ParticleSystemPool gObjectPoolInterface, ParticleSystemPool particleSystemEnd, ParticleSystemPool particleSystemTar) { isEnd = false; besselPathGroup.Start(); this.besselPathGroup = besselPathGroup; this.gObjectPoolInterface = gObjectPoolInterface; this.particleSystemEnd = particleSystemEnd; this.particleSystemTar = particleSystemTar; // gObjectPoolInterface.SetActive(true); _currTime = 0; _timeAdd = 1.0f / _speed; StaticUpdater.Instance.AddRenderUpdateCallBack(Update); } public void Update() { if (isEnd) { _currTime += Time.deltaTime; if (_currTime > 2) { CObjectPool.Instance.Recycle(this); } return; } _currTime += Time.deltaTime * _timeAdd; if (_currTime > 0.3f&&!particleSystemTar.own.activeSelf) { particleSystemTar.ActiveObj(); } if (_currTime > 1) { _currTime = 1; } Vector3 pos = besselPathGroup.CalculatePoint(_currTime); gObjectPoolInterface.gameObject.transform.position = pos; if (_currTime >= 1 && !isEnd) { GObjectPool.Instance.Recycle(gObjectPoolInterface); particleSystemEnd.ActiveObj(); _currTime = 0; isEnd = true; } } public override void ActiveObj() { } public override void DormancyObj() { besselPathGroup = null; gObjectPoolInterface = null; particleSystemEnd = null; particleSystemTar = null; StaticUpdater.Instance.RemoveRenderUpdateCallBack(Update); } } }