64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using FluffyUnderware.Curvy;
|
|
using FluffyUnderware.Curvy.Controllers;
|
|
using UnityEngine;
|
|
|
|
public class SplineSwitcher : MonoBehaviour
|
|
{
|
|
public GameObject spline1;
|
|
public GameObject spline2;
|
|
public GameObject spline3;
|
|
public GameObject spline4;
|
|
public GameObject spline5;
|
|
public GameObject spline6;
|
|
public GameObject spline7;
|
|
public int currentIndex = 1;
|
|
|
|
public CurvySpline GetDefaultController()
|
|
{
|
|
return spline1.GetComponent<CurvySpline>();
|
|
}
|
|
|
|
public CurvySpline Next()
|
|
{
|
|
if (currentIndex >= 7)
|
|
return spline7.GetComponent<CurvySpline>();
|
|
currentIndex++;
|
|
Clear();
|
|
switch (currentIndex)
|
|
{
|
|
case 2:
|
|
spline2.SetActive(true);
|
|
return spline2.GetComponent<CurvySpline>();
|
|
case 3:
|
|
spline3.SetActive(true);
|
|
return spline3.GetComponent<CurvySpline>();
|
|
case 4:
|
|
spline4.SetActive(true);
|
|
return spline4.GetComponent<CurvySpline>();
|
|
case 5:
|
|
spline5.SetActive(true);
|
|
return spline5.GetComponent<CurvySpline>();
|
|
case 6:
|
|
spline6.SetActive(true);
|
|
return spline6.GetComponent<CurvySpline>();
|
|
case 7:
|
|
spline7.SetActive(true);
|
|
return spline7.GetComponent<CurvySpline>();
|
|
default:
|
|
break;
|
|
}
|
|
return spline1.GetComponent<CurvySpline>();
|
|
}
|
|
|
|
private void Clear()
|
|
{
|
|
spline1.SetActive(false);
|
|
spline2.SetActive(false);
|
|
spline3.SetActive(false);
|
|
spline4.SetActive(false);
|
|
spline5.SetActive(false);
|
|
spline6.SetActive(false);
|
|
spline7.SetActive(false);
|
|
}
|
|
}
|