76 lines
2.4 KiB
C#
76 lines
2.4 KiB
C#
using UnityEngine;
|
|
|
|
namespace Ashwild.Inventory
|
|
{
|
|
public enum ItemType
|
|
{
|
|
Material,
|
|
Tool,
|
|
Weapon,
|
|
Consumable
|
|
}
|
|
|
|
public enum HarvestType
|
|
{
|
|
None,
|
|
Tree,
|
|
Rock
|
|
}
|
|
|
|
[CreateAssetMenu(fileName = "NewItem", menuName = "Items/Item Data")]
|
|
public class ItemData : ScriptableObject
|
|
{
|
|
[Header("Identity")]
|
|
[SerializeField] private string itemName;
|
|
[SerializeField] private Sprite icon;
|
|
[SerializeField] [TextArea] private string description;
|
|
|
|
[Header("Stacking")]
|
|
[SerializeField] private bool isStackable = true;
|
|
[SerializeField] private int maxStackSize = 64;
|
|
|
|
[Header("Type")]
|
|
[SerializeField] private ItemType itemType;
|
|
|
|
[Header("Tool")]
|
|
[SerializeField] private HarvestType harvestType = HarvestType.None;
|
|
[SerializeField] private float toolPower = 1f;
|
|
|
|
[Header("Consumable")]
|
|
[SerializeField] private float healthRestore;
|
|
[SerializeField] private float hungerRestore;
|
|
[SerializeField] private float thirstRestore;
|
|
|
|
[Header("Cooking")]
|
|
[SerializeField] private ItemData cookedResult;
|
|
[SerializeField] private float cookTime = 10f;
|
|
|
|
[Header("Fuel")]
|
|
[SerializeField] private bool isFuel;
|
|
[SerializeField] private float fuelSeconds = 30f;
|
|
|
|
[Header("Prefabs")]
|
|
[SerializeField] private GameObject worldPrefab;
|
|
[SerializeField] private GameObject handPrefab;
|
|
|
|
public string ItemName => itemName;
|
|
public Sprite Icon => icon;
|
|
public string Description => description;
|
|
public bool IsStackable => isStackable;
|
|
public int MaxStackSize => maxStackSize;
|
|
public ItemType ItemType => itemType;
|
|
public HarvestType HarvestType => harvestType;
|
|
public float ToolPower => toolPower;
|
|
public float HealthRestore => healthRestore;
|
|
public float HungerRestore => hungerRestore;
|
|
public float ThirstRestore => thirstRestore;
|
|
public ItemData CookedResult => cookedResult;
|
|
public float CookTime => cookTime;
|
|
public bool IsCookable => cookedResult != null;
|
|
public bool IsFuel => isFuel;
|
|
public float FuelSeconds => fuelSeconds;
|
|
public GameObject WorldPrefab => worldPrefab;
|
|
public GameObject HandPrefab => handPrefab;
|
|
}
|
|
}
|