41 lines
949 B
C#
41 lines
949 B
C#
using UnityEngine;
|
|
|
|
namespace OTGIntegrated.Items
|
|
{
|
|
public enum ItemType
|
|
{
|
|
Resource,
|
|
Consumable,
|
|
Weapon,
|
|
Quest,
|
|
Crafted
|
|
}
|
|
|
|
[CreateAssetMenu(fileName = "ItemData", menuName = "OTG Integrated/Item Data")]
|
|
public sealed class ItemData : ScriptableObject
|
|
{
|
|
public string itemId;
|
|
public string displayName;
|
|
[TextArea(2, 5)] public string description;
|
|
[Min(1)] public int maxStack = 20;
|
|
public ItemType itemType = ItemType.Resource;
|
|
public Color itemColor = Color.white;
|
|
public Sprite icon;
|
|
|
|
private void OnValidate()
|
|
{
|
|
if (string.IsNullOrWhiteSpace(itemId))
|
|
{
|
|
itemId = name;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(displayName))
|
|
{
|
|
displayName = itemId;
|
|
}
|
|
|
|
maxStack = Mathf.Max(1, maxStack);
|
|
}
|
|
}
|
|
}
|