S9062_FxLogic.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. moveTarget.transform.position = pos;
  35. if (_currTime >=1)
  36. {
  37. Dispose();
  38. PlayHit();
  39. }
  40. }
  41. }