using System.Collections; using System.Collections.Generic; using UnityEngine; public class ShowRoute : MonoBehaviour { public List list_Route1; public List list_Route2; public List list_Route3; public List list_Route4; public List list_Route5; public List list_Route6; public List list_Points; private void Start() { SettingRoute(1, true); } public void SettingRoute( int index , bool state ) { if (!state) return; Route(list_Route1,false); Route(list_Route2,false); Route(list_Route3,false); Route(list_Route4,false); Route(list_Route5,false); Route(list_Route6,false); switch (index) { case 1: ClosePoint(); list_Points[0].SetActive(true); Route(list_Route1, true); break; case 2: ClosePoint(); list_Points[0].SetActive(true); list_Points[1].SetActive(true); Route(list_Route2, true); break; case 3: ClosePoint(); list_Points[2].SetActive(true); list_Points[1].SetActive(true); Route(list_Route3, true); break; case 4: ClosePoint(); list_Points[1].SetActive(true); list_Points[2].SetActive(true); Route(list_Route4, true); break; case 5: ClosePoint(); list_Points[3].SetActive(true); list_Points[2].SetActive(true); Route(list_Route5, true); break; case 6: ClosePoint(); Route(list_Route6, true); break; default: break; } } private void Route( List list_route , bool state) { for (int i = 0; i < list_route.Count; i++) { list_route[i].SetActive(state); } } private void ClosePoint() { for (int i = 0; i < list_Points.Count; i++) { list_Points[i].SetActive(false); } } }