1234567891011121314151617181920212223242526272829303132333435363738 |
- using Controller.Bicycle;
- using UnityEngine;
- namespace Routes
- {
- public class RouteManager : MonoBehaviour
- {
- public Route[] routes;
- public int selectedRoute;
- public int visibleLength = 3;
- public RbBicycleController bicycle;
- public Logging.Base.Logging logging;
- public GameObject showOnFinish;
- private void Start()
- {
- for (var i = 0; i < routes.Length; i++)
- {
- routes[i].gameObject.SetActive(i == selectedRoute);
- }
-
- routes[selectedRoute].OnStartEntered += OnOnStartEntered;
- routes[selectedRoute].OnFinishPassed +=OnOnFinishPassed;
- }
- private void OnOnFinishPassed()
- {
- bicycle.enabled = false;
- Instantiate(showOnFinish, bicycle.transform);
- Destroy(logging.gameObject);
- }
- private void OnOnStartEntered()
- {
- logging.gameObject.SetActive(true);
- }
- }
- }
|