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