| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 | using System.Collections;using System.Collections.Generic;using CombatLibrary.CombatLibrary.CombatCore.Utility;using Fort23.UTool;using UnityEngine;public class ImageMoveContainer{    protected List<ImageMove> allImageMove = new List<ImageMove>();    public void AddACurve(Vector2 startPos, Vector2 target, float delay, float speed, GameObjectPool gameObjectPool,System.Action<ImageMove> finishCallBack = null,        AnimationCurve ui_showSize = null, AnimationCurve ui_moveSize = null, AnimationCurve ui_moveSpped = null)    {        ACurve aCurve = new ACurve();        CurveInfo curveInfo = new CurveInfo();        Vector3 p = startPos + (startPos - target).normalized * 1;        Vector3 moveTargetPos = new Vector3(p.x + Random.Range(-0, 0),            p.y + Random.Range(-0, 0));        Vector2 newStartPos = moveTargetPos;        curveInfo.t = newStartPos.x;        curveInfo.v = newStartPos.y;        curveInfo.BSLt = 0;        float x = Random.Range(-10, 10) * 30;        Vector3 normal = (target - newStartPos).normalized;        normal = new Vector3(Random.Range(-100, 100), Random.Range(-100, 100));        curveInfo.it = normal.x + x + curveInfo.t;        curveInfo.ot = normal.y + curveInfo.v + 10;        CurveInfo curveInfo2 = new CurveInfo();        curveInfo2.t = target.x;        curveInfo2.v = target.y;        Vector3 normal2 = (newStartPos - target).normalized;        curveInfo2.it = normal2.x + x + curveInfo2.t;        curveInfo2.ot = normal2.y + curveInfo2.v + 10;        curveInfo2.BSLt = 1;        aCurve.CurveInfos = new List<CurveInfo>();        aCurve.CurveInfos.Add(curveInfo);        aCurve.CurveInfos.Add(curveInfo2);        aCurve.CurveType = CurveType.Linear;        ImageMove currImageMove = new ImageMove();        currImageMove.SizeCurve = ui_moveSize;        currImageMove.moveSpeed = ui_moveSpped;         gameObjectPool.own.SetActive(false);        currImageMove.GameObjectPool = gameObjectPool;            currImageMove.transform = gameObjectPool.own.GetComponent<RectTransform>();        currImageMove.moveStartPos = startPos;        currImageMove.transform.anchoredPosition = currImageMove.moveStartPos;        currImageMove.yanChi = delay;        currImageMove.speed = speed;        currImageMove.currAcur = aCurve;        currImageMove.finishCallBack = finishCallBack;        allImageMove.Add(currImageMove);                StaticUpdater.Instance.RemoveRenderUpdateCallBack(RenderUpdateCallBack);        StaticUpdater.Instance.AddRenderUpdateCallBack(RenderUpdateCallBack);    }    public void RenderUpdateCallBack()    {        for (int i = 0; i < allImageMove.Count; i++)        {            ImageMove imageMove = allImageMove[i];            if (imageMove.Update())            {                Dispose();                // allImageMove.RemoveAt(i);                // imageMove.GameObjectPool.own.SetActive(false);                i--;            }        }    }    public void Dispose()    {        for (int i = 0; i < allImageMove.Count; i++)        {            ImageMove imageMove = allImageMove[i];            GObjectPool.Instance.Recycle(imageMove.GameObjectPool);            allImageMove.RemoveAt(i);            i--;        }        StaticUpdater.Instance.RemoveRenderUpdateCallBack(RenderUpdateCallBack);    }}
 |