18 lines
490 B
C#
18 lines
490 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class Suicide : MonoBehaviour
|
||
|
{
|
||
|
// This method is called when a collision occurs
|
||
|
private void OnCollisionEnter(Collision collision)
|
||
|
{
|
||
|
// Check if the collision is with the specific object you want
|
||
|
if (collision.gameObject.CompareTag("Bullet"))
|
||
|
{
|
||
|
// Your collision handling code goes here
|
||
|
transform.Translate(Vector3.up * 2);
|
||
|
}
|
||
|
}
|
||
|
}
|