using System.Collections; using System.Collections.Generic; using UnityEngine; public class MoneyOnEnemyDeath : MonoBehaviour { private HealthComponent healthComp; [SerializeField] private float MoneyDropOnDeath; private void OnEnable() { healthComp = GetComponent(); healthComp.OnHealthZero.AddListener(OnDeath); } private void OnDisable() { healthComp.OnHealthZero.RemoveListener(OnDeath); } void OnDeath() { GameManager.Instance.Balance.Value += MoneyDropOnDeath; } }