using System; using System.Collections.Generic; using KitsuneCafe.SOAP; using KitsuneCafe.System; using KitsuneCafe.System.Attributes; using UnityEngine; namespace KitsuneCafe.ItemSystem { public enum ItemType { Normal, Weapon, Tool } [CreateAssetMenu(menuName = KitsuneCafeMenu.Item + "Item")] public class Item : ScriptableObject { [SerializeField] private string id; public string Id => id; [SerializeField] private string displayName; public string DisplayName => displayName; [SerializeField, TextArea] private string description; public string Description => description; [SerializeField] private List tags; public IReadOnlyList Tags => tags; [SerializeField] private ItemType type; public ItemType Type => type; [SerializeField] private bool stackable; public bool IsStackable => stackable; [SerializeField, ShowIf("stackable")] private int maxStackCount = 10; public int MaxStackCount => maxStackCount; [SerializeField] private Texture2D icon; public Texture2D Icon => icon; [SerializeField] private GameObject instancePrefab; [SerializeField] private GameObject previewPrefab; private void Reset() { GenerateNewId(); } [Button("Generate New ID")] private void GenerateNewId() { id = Guid.NewGuid().ToString(); #if UNITY_EDITOR UnityEditor.EditorUtility.SetDirty(this); #endif } public GameObject CreateInstance() { return Instantiate(instancePrefab); } public GameObject CreatePreview() { return Instantiate(previewPrefab); } } }