You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
380 B
C#
16 lines
380 B
C#
using UnityEngine;
|
|
|
|
public class MoleMouth : MonoBehaviour
|
|
{
|
|
public AudioSource eatingSound; // Optional: drag a sound in the inspector
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.CompareTag("Food"))
|
|
{
|
|
if (eatingSound != null) eatingSound.Play();
|
|
Destroy(other.gameObject); // Remove the sphere
|
|
}
|
|
}
|
|
}
|