2025-12-04 08:22:30 +01:00

20 lines
347 B
C#

using UnityEngine;
public class Food : MonoBehaviour
{
[SerializeField] private int score = 10;
Health health;
void Start()
{
health = GetComponent<Health>();
health.OnDeath += OnDeath;
}
void OnDeath()
{
GameManager.Instance.AddScore(score);
gameObject.SetActive(false);
}
}