123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System.Collections;
- using System.Collections.Generic;
- using CombatLibrary.CombatLibrary.CombatCore.Utility;
- using Fort23.UTool;
- using UnityEngine;
- public class ImageMove
- {
- // public AnimationCurve ShowSizeCurve;
- public AnimationCurve SizeCurve;
- public AnimationCurve moveSpeed;
- public GameObjectPool GameObjectPool;
- public RectTransform transform;
- public ACurve currAcur;
- public float yanChi;
- private float currTime;
- public float speed;
- // public float showSizeSpeed;
- public bool isShowSize = true;
- public Vector3 moveTargetPos;
- public Vector3 moveStartPos;
- public System.Action finishCallBack;
- public bool Update()
- {
- if (currAcur.CurveInfos == null)
- {
- return true;
- }
- yanChi -= Time.deltaTime;
- if (yanChi > 0)
- {
- return false;
- }
- GameObjectPool.own.gameObject.SetActive(true);
- // if (isShowSize)
- // {
- // currTime += Time.deltaTime * showSizeSpeed;
- // float ss = currTime;
- // if (ShowSizeCurve != null)
- // {
- // ss = ShowSizeCurve.Evaluate(currTime);
- // transform.localScale = Vector3.one * ss;
- // }
- //
- //
- // Vector3 p = Vector3.Lerp(moveStartPos, moveTargetPos, ss);
- // transform.anchoredPosition = p;
- // if (currTime >= 1)
- // {
- // isShowSize = false;
- // currTime = 0;
- // }
- //
- // return false;
- // }
- currTime += Time.deltaTime * speed;
- float ms = currTime;
- if (moveSpeed != null)
- {
- ms = moveSpeed.Evaluate(currTime);
- }
- transform.anchoredPosition = currAcur.EvaluateForVector2(ms, ms);
- float s = currTime;
- if (SizeCurve != null)
- {
- s = SizeCurve.Evaluate(currTime);
- transform.localScale = Vector3.one * s;
- }
- if (currTime > 1)
- {
- currAcur.CurveInfos = null;
- finishCallBack?.Invoke();
- }
- return false;
- }
- }
|