123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using Pools;
- using Routes;
- using UnityEngine;
- namespace Roads
- {
- public class StraightRoadExtras : MonoBehaviour
- {
- public GameObject arcPrefab;
- private GameObject arc;
- private bool hasArc;
- public TriggerState ArcState { get; private set; } = TriggerState.Outside;
- public void ShowArc()
- {
- arc = Instantiate(arcPrefab, transform);
- hasArc = arc != null;
- }
- private void OnTriggerEnter(Collider other)
- {
- if (hasArc && other.CompareTag("bike"))
- {
- ArcState = TriggerState.Inside;
- }
- }
- private void OnTriggerExit(Collider other)
- {
- if (hasArc && other.CompareTag("bike"))
- {
- Destroy(arc);
- ArcState = TriggerState.Outside;
- }
- }
- }
- }
|