using UnityEngine; using UnityEngine.Events; public class BaseItem : MonoBehaviour, IInteractable { [SerializeField] private float _scoreAdd = 0; [SerializeField] private bool _selfDestroy = true; protected ScoreController _scoreController; public UnityEvent OnInterract; protected virtual void Awake() { _scoreController = FindObjectOfType(); } public virtual void Interact() { OnInterract?.Invoke(); if (_scoreAdd > 0) _scoreController.AddScore(_scoreAdd, true); if (_selfDestroy) Destroy(gameObject); } }