1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- 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;
- 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;
- }
- }
- }
|