ShowRoute.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ShowRoute : MonoBehaviour
  5. {
  6. public List<GameObject> list_Route1;
  7. public List<GameObject> list_Route2;
  8. public List<GameObject> list_Route3;
  9. public List<GameObject> list_Route4;
  10. public List<GameObject> list_Route5;
  11. public List<GameObject> list_Route6;
  12. public List<GameObject> list_Points;
  13. private void Start()
  14. {
  15. SettingRoute(1, true);
  16. }
  17. public void SettingRoute( int index , bool state )
  18. {
  19. if (!state) return;
  20. Route(list_Route1,false);
  21. Route(list_Route2,false);
  22. Route(list_Route3,false);
  23. Route(list_Route4,false);
  24. Route(list_Route5,false);
  25. Route(list_Route6,false);
  26. switch (index)
  27. {
  28. case 1:
  29. ClosePoint();
  30. list_Points[0].SetActive(true);
  31. Route(list_Route1, true);
  32. break;
  33. case 2:
  34. ClosePoint();
  35. list_Points[0].SetActive(true);
  36. list_Points[1].SetActive(true);
  37. Route(list_Route2, true);
  38. break;
  39. case 3:
  40. ClosePoint();
  41. list_Points[2].SetActive(true);
  42. list_Points[1].SetActive(true);
  43. Route(list_Route3, true);
  44. break;
  45. case 4:
  46. ClosePoint();
  47. list_Points[1].SetActive(true);
  48. list_Points[2].SetActive(true);
  49. Route(list_Route4, true);
  50. break;
  51. case 5:
  52. ClosePoint();
  53. list_Points[3].SetActive(true);
  54. list_Points[2].SetActive(true);
  55. Route(list_Route5, true);
  56. break;
  57. case 6:
  58. ClosePoint();
  59. Route(list_Route6, true);
  60. break;
  61. default:
  62. break;
  63. }
  64. }
  65. private void Route( List<GameObject> list_route , bool state)
  66. {
  67. for (int i = 0; i < list_route.Count; i++)
  68. {
  69. list_route[i].SetActive(state);
  70. }
  71. }
  72. private void ClosePoint()
  73. {
  74. for (int i = 0; i < list_Points.Count; i++)
  75. {
  76. list_Points[i].SetActive(false);
  77. }
  78. }
  79. }