using System.Collections.Generic; using UnityEngine; namespace Core.Utility { public class BesselPathGroup { public float lane; public List allBesselPath = new List(); 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; for (int i = 0; i < allBesselPath.Count; i++) { BesselPath besselPath = allBesselPath[i]; 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 Vector3.zero; } } }