123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ShowRoute : MonoBehaviour
- {
- public List<GameObject> list_Route1;
- public List<GameObject> list_Route2;
- public List<GameObject> list_Route3;
- public List<GameObject> list_Route4;
- public List<GameObject> list_Route5;
- public List<GameObject> list_Route6;
- public List<GameObject> 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<GameObject> 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);
- }
- }
- }
|