S9062_FxLogic.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using Common.Combat.FxAILogic;
  4. using Core.Utility;
  5. using UnityEngine;
  6. public class S9062_FxLogic : FxAILogicBasic
  7. {
  8. public float speed;
  9. private Vector3 targetPos;
  10. private BesselPath moveBezierPath;
  11. private float _currTime;
  12. private float _addTime;
  13. protected override void ProInit()
  14. {
  15. targetPos = TimeLineEventParticleLogicBasic.customizePos[0];
  16. if (moveBezierPath == null)
  17. {
  18. moveBezierPath = new BesselPath();
  19. }
  20. moveBezierPath.controlPoints.Clear();
  21. Vector3 dir = (targetPos - startPos);
  22. Vector3 zxPoint = startPos + dir * 0.5f + new Vector3(0, 5, 0);
  23. moveBezierPath.controlPoints.Add(startPos);
  24. moveBezierPath.controlPoints.Add(zxPoint);
  25. moveBezierPath.controlPoints.Add(targetPos);
  26. moveBezierPath.SetLengthAtT();
  27. _addTime = 1.0f / (moveBezierPath.allDis / speed);
  28. _currTime = 0;
  29. }
  30. protected override void ProCombatUpdate(float time)
  31. {
  32. _currTime += time * _addTime;
  33. Vector3 pos = moveBezierPath.CalculatePoint(_currTime);
  34. _currPos=pos;
  35. moveTarget.transform.position = pos;
  36. if (_currTime >=1)
  37. {
  38. Dispose();
  39. PlayHit();
  40. }
  41. }
  42. }