using Ai; using UnityEngine; namespace Meta { [RequireComponent(typeof(Body))] public class EnemyDrop : MonoBehaviour { [SerializeField] private int _exp; [SerializeField] private int _coins; [SerializeField] private Body _body; private void Awake() { if (_body != null) _body.DeathEvent += Drop; } private void OnDisable() { if (_body != null) _body.DeathEvent -= Drop; } private void Drop() { PlayerResources.Instance.AddExp(_exp); PlayerResources.Instance.AddCoins(_coins); } private void OnValidate() { if (_body == null) _body = GetComponent(); } } }