MiniGames/Assets/MoleMouth.cs
2025-07-11 15:42:48 +05:00

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
}
}
}