123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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);
- }
- }
- }
|