using System; using KitsuneCafe.ItemSystem; using UnityEngine; namespace KitsuneCafe.Interaction { public class AddItem : MonoBehaviour { [SerializeField] private Item item; [SerializeField] private int count = 1; public void ToInventory(IInventory inventory) where T : IEquatable, ICountable { Debug.Log(inventory.Add(item, count)); } public bool ToGameObject(GameObject gameObject) { if (gameObject != null && gameObject.TryGetComponent(out var inventory)) { ToInventory(inventory); return false; } return true; } public void ToInteractor(IInteractor interactor) { ToGameObject(interactor.Root); } } }