14 lines
299 B
C#
14 lines
299 B
C#
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class ObjectHit : MonoBehaviour
|
||
|
|
{
|
||
|
|
private void OnCollisionEnter(Collision other)
|
||
|
|
{
|
||
|
|
if (other.gameObject.tag == "Player")
|
||
|
|
{
|
||
|
|
GetComponent<MeshRenderer>().material.color = Color.black;
|
||
|
|
gameObject.tag = "Hit";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|