05-29-2023, 03:16 PM
If it has reached the end of the spline, I want it to move to the next spline. I want to do this through code. It switches from spline 1 to spline 2 but does not complete spline 2. and it doesn't switch to the 3rd spline. How can I do it?
My SplineController Code:
public void GoNextSpline()
{
SwitchTo(splineTest, 1, 1);
IsAtEnd = false;
}
public void OnEndReachedMethod()
{
IsAtEnd = true;
}
My Other Code:
public CurvySpline myPreviousSpline;
public CurvySpline myEnterSpline;
public CurvySpline myExitSpline;
public SplineController splineController;
void Update()
{
if (splineController.Spline == previousSpline && splineController.IsAtEnd)
splineController.GoNextSpline();
if (splineController.Spline == enterSpline && splineController.IsAtEnd)
splineController.GoNextSpline();
if (splineController.Spline == exitSpline && splineController.IsAtEnd)
splineController.GoNextSpline();
}
My SplineController Code:
public void GoNextSpline()
{
SwitchTo(splineTest, 1, 1);
IsAtEnd = false;
}
public void OnEndReachedMethod()
{
IsAtEnd = true;
}
My Other Code:
public CurvySpline myPreviousSpline;
public CurvySpline myEnterSpline;
public CurvySpline myExitSpline;
public SplineController splineController;
void Update()
{
if (splineController.Spline == previousSpline && splineController.IsAtEnd)
splineController.GoNextSpline();
if (splineController.Spline == enterSpline && splineController.IsAtEnd)
splineController.GoNextSpline();
if (splineController.Spline == exitSpline && splineController.IsAtEnd)
splineController.GoNextSpline();
}