using System; using KitsuneCafe.Sys; using UnityEngine; namespace KitsuneCafe.ItemSystem { [CreateAssetMenu(menuName = KitsuneCafeMenu.Item + "Equipment")] public class Equipment : Item, IEquipmentItem, IEquatable { [SerializeField] private GameObject equippedPrefab; public GameObject EquippedPrefab => equippedPrefab; private void OnValidate() { if (equippedPrefab != null && equippedPrefab.GetComponent() == null) { Debug.LogWarning($"Equipment prefab {equippedPrefab} has no instance of IEquipment."); equippedPrefab = null; } } public IEquippable CreateEquipment() { return Instantiate(equippedPrefab).GetComponent(); } public bool Equals(Equipment other) { return Id == other.Id; } } }