Добавлен гудок машинам

This commit is contained in:
2025-01-31 14:00:16 +03:00
parent 7dcd08212d
commit 64d5577fd8
19 changed files with 1588 additions and 13 deletions

31
Assets/CarBipScript.cs Normal file
View File

@ -0,0 +1,31 @@
using UnityEngine;
using UnityEngine.Events;
public class CarBipScript : MonoBehaviour
{
[HideInInspector]
public UnityEvent<HitDetectorScript> PlayerEntered = new UnityEvent<HitDetectorScript>();
[HideInInspector]
public UnityEvent<HitDetectorScript> PlayerExited = new UnityEvent<HitDetectorScript>();
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
Debug.Log("Player Enter");
HitDetectorScript hit = other.GetComponent<HitDetectorScript>();
PlayerEntered.Invoke(hit);
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == "Player")
{
Debug.Log("Player Exit");
HitDetectorScript hit = other.GetComponent<HitDetectorScript>();
PlayerExited.Invoke(hit);
}
}
}