CombatSencePath.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using Fort23.Core;
  4. using Fort23.UTool;
  5. using UnityEngine;
  6. namespace GameLogic.Combat.CombatTool
  7. {
  8. [Serializable]
  9. public class CombatSencePath: CObject
  10. {
  11. public Vector3 a;
  12. public Vector3 b;
  13. private Vector3 Centre;
  14. private bool isCentre;
  15. public float reclaimTime;
  16. public List<GameObjectPool>allPool = new List<GameObjectPool>();
  17. public void SetPos(Vector3 startPos, Vector3 target)
  18. {
  19. a = startPos;
  20. b = target;
  21. isCentre = false;
  22. }
  23. public void SetPos(Vector3 startPos, Vector3 centre, Vector3 target)
  24. {
  25. a = startPos;
  26. Centre = centre;
  27. b = target;
  28. isCentre = true;
  29. }
  30. public Vector3 GetValue(float t)
  31. {
  32. float t1 = t;
  33. if (t1 > 1)
  34. {
  35. t1 = 1;
  36. }
  37. if (t1 < 0)
  38. {
  39. t1 = 0;
  40. }
  41. if (isCentre)
  42. {
  43. Vector3 p1 = Vector3.Lerp(a, Centre, t1);
  44. Vector3 p2 = Vector3.Lerp(p1, b, t1);
  45. return p2;
  46. }
  47. else
  48. {
  49. return Vector3.Lerp(a, b, t1);
  50. }
  51. }
  52. public override void ActiveObj()
  53. {
  54. }
  55. public override void DormancyObj()
  56. {
  57. for (int i = 0; i < allPool.Count; i++)
  58. {
  59. GObjectPool.Instance.Recycle(allPool[i]);
  60. }
  61. allPool.Clear();
  62. }
  63. }
  64. }