ImageMove.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using CombatLibrary.CombatLibrary.CombatCore.Utility;
  4. using Fort23.UTool;
  5. using UnityEngine;
  6. public class ImageMove
  7. {
  8. // public AnimationCurve ShowSizeCurve;
  9. public AnimationCurve SizeCurve;
  10. public AnimationCurve moveSpeed;
  11. public GameObjectPool GameObjectPool;
  12. public RectTransform transform;
  13. public ACurve currAcur;
  14. public float yanChi;
  15. private float currTime;
  16. public float speed;
  17. // public float showSizeSpeed;
  18. public bool isShowSize = true;
  19. public Vector3 moveTargetPos;
  20. public Vector3 moveStartPos;
  21. public bool Update()
  22. {
  23. if (currAcur.CurveInfos == null)
  24. {
  25. return true;
  26. }
  27. yanChi -= Time.deltaTime;
  28. if (yanChi > 0)
  29. {
  30. return false;
  31. }
  32. GameObjectPool.own.gameObject.SetActive(true);
  33. // if (isShowSize)
  34. // {
  35. // currTime += Time.deltaTime * showSizeSpeed;
  36. // float ss = currTime;
  37. // if (ShowSizeCurve != null)
  38. // {
  39. // ss = ShowSizeCurve.Evaluate(currTime);
  40. // transform.localScale = Vector3.one * ss;
  41. // }
  42. //
  43. //
  44. // Vector3 p = Vector3.Lerp(moveStartPos, moveTargetPos, ss);
  45. // transform.anchoredPosition = p;
  46. // if (currTime >= 1)
  47. // {
  48. // isShowSize = false;
  49. // currTime = 0;
  50. // }
  51. //
  52. // return false;
  53. // }
  54. currTime += Time.deltaTime * speed;
  55. float ms = currTime;
  56. if (moveSpeed != null)
  57. {
  58. ms = moveSpeed.Evaluate(currTime);
  59. }
  60. transform.anchoredPosition = currAcur.EvaluateForVector2(ms,ms);
  61. float s = currTime;
  62. if (SizeCurve != null)
  63. {
  64. s = SizeCurve.Evaluate(currTime);
  65. transform.localScale = Vector3.one * s;
  66. }
  67. if (currTime > 1)
  68. {
  69. currAcur.CurveInfos = null;
  70. }
  71. return false;
  72. }
  73. }