StraightRoadExtras.cs 513 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using Pools;
  3. using UnityEngine;
  4. namespace Roads
  5. {
  6. public class StraightRoadExtras : MonoBehaviour
  7. {
  8. public GameObject arcPrefab;
  9. private GameObject arc;
  10. private bool hasArc;
  11. public void ShowArc()
  12. {
  13. arc = Instantiate(arcPrefab, transform);
  14. hasArc = arc != null;
  15. }
  16. private void OnTriggerExit(Collider other)
  17. {
  18. if (hasArc && other.CompareTag("bike"))
  19. {
  20. Destroy(arc);
  21. }
  22. }
  23. }
  24. }