MiniGames/Assets/MoleMouth.cs

16 lines
380 B
C#
Raw Permalink Normal View History

2025-07-11 15:42:48 +05:00
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
}
}
}