| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 | using System.Collections.Generic;using UnityEngine;namespace Core.Utility{    public class BesselPathGroup    {        public float lane;        public List<BesselPath> allBesselPath = new List<BesselPath>();        public void AddBesselPath(BesselPath besselPath)        {            allBesselPath.Add(besselPath);        }        public void Start()        {            lane = 0;            for (int i = 0; i < allBesselPath.Count; i++)            {                BesselPath besselPath = allBesselPath[i];                besselPath.SetLengthAtT();                lane += besselPath.allDis;            }        }        public Vector3 CalculatePoint(float t)        {                     // BesselPath currBeselPath = null;            float currLane = 0;            Vector3 endPos=Vector3.zero;            for (int i = 0; i < allBesselPath.Count; i++)            {                BesselPath besselPath = allBesselPath[i];                endPos=besselPath.controlPoints[^1];                float allLane = currLane;                allLane += besselPath.allDis;                float b = allLane / lane;                if (t <= b)                {                    float lasetB = currLane / lane;                    b -= lasetB;                    t -= lasetB;                    float currB = t / b;                    return besselPath.CalculatePoint(currB);                }                currLane = allLane;            }            return endPos;        }    }}
 |