20 lines
347 B
C#
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);
|
|
}
|
|
}
|