58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.Serialization;
|
||
|
|
|
||
|
|
namespace Inventory
|
||
|
|
{
|
||
|
|
public enum ItemType
|
||
|
|
{
|
||
|
|
Resource, // 资源(不可直接使用)
|
||
|
|
Consumable, // 消耗品(吃/喝/用)
|
||
|
|
Equipment, // 装备(平板、手电筒、武器)
|
||
|
|
Tool // 工具(斧头,主要用于交互)
|
||
|
|
}
|
||
|
|
|
||
|
|
[CreateAssetMenu(menuName = "Inventory/Item Data")]
|
||
|
|
public class ItemData : ScriptableObject
|
||
|
|
{
|
||
|
|
[System.Serializable]
|
||
|
|
public class SpecialUseUIPage
|
||
|
|
{
|
||
|
|
[TextArea(2, 8)] public string text;
|
||
|
|
}
|
||
|
|
|
||
|
|
public string id;
|
||
|
|
public string displayName;
|
||
|
|
[TextArea(3, 10)] public string description;
|
||
|
|
public Sprite icon;
|
||
|
|
public GameObject pickupPrefab; // 掉落/生成在世界中的物体预设体
|
||
|
|
public GameObject handModelPrefab; // 手持时的模型预设体
|
||
|
|
|
||
|
|
[Header("Usage Settings")]
|
||
|
|
public ItemType itemType; // 物品类型
|
||
|
|
public ItemData consumedResult; // 消耗后获得的物品(为空则直接消失)
|
||
|
|
|
||
|
|
[Header("Vitals Effects (Consumable)")]
|
||
|
|
[FormerlySerializedAs("healthDelta")] public float thirstDelta;
|
||
|
|
public float hungerDelta;
|
||
|
|
public float sanityDelta;
|
||
|
|
|
||
|
|
public bool isStackable;
|
||
|
|
public int maxStackSize = 1;
|
||
|
|
|
||
|
|
[Header("Hold Settings")]
|
||
|
|
[Tooltip("是否使用自定义手持位置/旋转")]
|
||
|
|
public bool useCustomHoldSettings;
|
||
|
|
public Vector3 holdPositionOffset;
|
||
|
|
public Vector3 holdRotationOffset;
|
||
|
|
public Vector3 holdScale = Vector3.one;
|
||
|
|
|
||
|
|
[Header("Special Use UI")]
|
||
|
|
public bool showSpecialUseUI;
|
||
|
|
[TextArea(2, 8)] public string specialUseUIText;
|
||
|
|
public Sprite specialUseSprite;
|
||
|
|
public bool useSpecialUseUIPages;
|
||
|
|
public List<SpecialUseUIPage> specialUseUIPages = new List<SpecialUseUIPage>();
|
||
|
|
}
|
||
|
|
}
|