1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using UnityEditor;
- using UnityEngine;
- using Valve.VR.InteractionSystem;
- namespace Routes
- {
- public class RouteManager : MonoBehaviour
- {
- public Route[] routes;
- public int selectedRoute;
- private void Awake()
- {
- ShowActiveRoute();
- }
- private void ShowActiveRoute()
- {
- routes.ForEach(r => r.Clear());
- routes[selectedRoute].Show(); //TODO: maybe show when coming to it
- }
- private void OnValidate()
- {
- ChangeActiveRoute();
- if (EditorApplication.isPlaying)
- {
- ShowActiveRoute();
- }
- }
- private void ChangeActiveRoute()
- {
- for (int i = 0; i < routes.Length; i++)
- {
- routes[i].gameObject.SetActive(i == selectedRoute);
- }
- }
- }
- }
|