UseSkillShowFxMono.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Core.Utility;
  2. using Fort23.Core;
  3. using Fort23.UTool;
  4. using UnityEngine;
  5. namespace Fort23.Mono
  6. {
  7. public class UseSkillShowFxMono : CObject
  8. {
  9. protected BesselPathGroup besselPathGroup;
  10. protected ParticleSystemPool gObjectPoolInterface;
  11. protected float _currTime;
  12. protected float _timeAdd;
  13. private float _speed =3;
  14. public void Init(BesselPathGroup besselPathGroup, ParticleSystemPool gObjectPoolInterface)
  15. {
  16. besselPathGroup.Start();
  17. this.besselPathGroup = besselPathGroup;
  18. this.gObjectPoolInterface = gObjectPoolInterface;
  19. _currTime = 0;
  20. _timeAdd = 1.0f /3;
  21. StaticUpdater.Instance.AddRenderUpdateCallBack(Update);
  22. }
  23. public void Update()
  24. {
  25. _currTime += Time.deltaTime*_timeAdd;
  26. Vector3 pos = besselPathGroup.CalculatePoint(_currTime);
  27. gObjectPoolInterface.gameObject.transform.position = pos;
  28. if (_currTime >= 1)
  29. {
  30. CObjectPool.Instance.Recycle(this);
  31. }
  32. }
  33. public override void ActiveObj()
  34. {
  35. }
  36. public override void DormancyObj()
  37. {
  38. GObjectPool.Instance.Recycle(gObjectPoolInterface);
  39. besselPathGroup = null;
  40. gObjectPoolInterface = null;
  41. StaticUpdater.Instance.RemoveRenderUpdateCallBack(Update);
  42. }
  43. }
  44. }