12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using System.Collections;
- using System.Collections.Generic;
- using CombatLibrary.CombatLibrary.CombatCore.Utility;
- using Fort23.Core;
- using Fort23.UTool;
- using UnityEngine;
- public class ImageMove: CObject
- {
- // 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 bool isExp;
- public Vector3 moveStartPos;
- public int GroupIndex = 0;
- public System.Action<ImageMove> finishCallBack;
- public System.Action<ImageMove> targetPointSet;
- public bool Update()
- {
- if (currAcur.CurveInfos == null)
- {
- return true;
- }
- yanChi -= Time.deltaTime;
- if (yanChi > 0)
- {
- return false;
- }
- targetPointSet?.Invoke(this);
- GameObjectPool.own.gameObject.SetActive(true);
-
- 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(this);
- CObjectPool.Instance.Recycle(this);
- }
- return false;
- }
- public override void ActiveObj()
- {
-
- }
- public override void DormancyObj()
- {
- GObjectPool.Instance.Recycle(GameObjectPool);
- GameObjectPool = null;
- finishCallBack = null;
- yanChi = 0;
- currTime = 0;
- transform = null;
- moveSpeed = null;
- SizeCurve = null;
- currAcur.CurveInfos = null;
- targetPointSet = null;
- }
- }
|