Pacman/Assets/Scripts/Pellet.cs
2025-04-20 21:10:16 +05:30

19 lines
359 B
C#

using UnityEngine;
public class Pellet : MonoBehaviour
{
public int points = 10;
protected virtual void Eat()
{
FindObjectOfType<GameManager>().PelletEaten(this);
}
private void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.layer == LayerMask.NameToLayer("Pacman"))
{
Eat();
}
}
}