Скрипт касания игрока машиной, переделывание префабов

This commit is contained in:
2024-12-18 16:02:21 +03:00
parent 937a6340ec
commit 2eb77c8dc2
98 changed files with 10112 additions and 2982 deletions

View File

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class HitDetectorScript : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
//Debug.Log(other.gameObject.name);
if (other.gameObject.CompareTag("Car"))
{
Debug.Log("Player was hitted car");
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
//private void OnCollisionEnter(Collision collision)
//{
// Debug.Log(collision.gameObject.name);
//}
//private void OnControllerColliderHit(ControllerColliderHit hit)
//{
// Debug.Log(hit.gameObject.name);
// if (hit.gameObject.CompareTag("Car"))
// {
// Debug.Log("Car hitted");
// }
//}
}