82 lines
2.6 KiB
C#
82 lines
2.6 KiB
C#
using BriarQueen.Data.Identifiers;
|
|
using BriarQueen.Framework.Managers.Interaction.Data;
|
|
using NaughtyAttributes;
|
|
using UnityEngine;
|
|
|
|
namespace BriarQueen.Framework.Managers.Player.Data
|
|
{
|
|
[CreateAssetMenu(menuName = "Briar Queen/Items/New Item Data", fileName = "New Item Data")]
|
|
public class ItemDataSo : ScriptableObject
|
|
{
|
|
public enum ItemIdType
|
|
{
|
|
None = 0,
|
|
Pickup = 1,
|
|
Environment = 2,
|
|
PuzzleSlot = 3
|
|
}
|
|
|
|
[Header("Item Type")]
|
|
[SerializeField]
|
|
private ItemIdType _idType;
|
|
|
|
[Header("Item Details")]
|
|
[Tooltip("Pickup key used for inventory items.")]
|
|
[SerializeField]
|
|
[ShowIf(nameof(IsPickup))]
|
|
private ItemKey _itemKey;
|
|
|
|
[Tooltip("Environment key used for world interactables.")]
|
|
[SerializeField]
|
|
[ShowIf(nameof(IsEnvironment))]
|
|
private EnvironmentKey _environmentKey;
|
|
|
|
[Tooltip("Puzzle slot key used for puzzle slot interactables.")]
|
|
[SerializeField]
|
|
[ShowIf(nameof(IsPuzzleSlot))]
|
|
private PuzzleSlotKey _puzzleSlotKey;
|
|
|
|
[SerializeField]
|
|
private Sprite _icon;
|
|
|
|
[SerializeField]
|
|
private string _itemName;
|
|
|
|
[Header("Inventory Interaction (serialized inline, no extra SO assets)")]
|
|
[SerializeReference]
|
|
private BaseInteraction _interaction = new NoOpItemInteraction();
|
|
|
|
public Sprite Icon => _icon;
|
|
public string ItemName => _itemName;
|
|
public BaseInteraction Interaction => _interaction;
|
|
|
|
public bool IsPickup => _idType == ItemIdType.Pickup;
|
|
public bool IsEnvironment => _idType == ItemIdType.Environment;
|
|
public bool IsPuzzleSlot => _idType == ItemIdType.PuzzleSlot;
|
|
|
|
public ItemIdType IdType => _idType;
|
|
public ItemKey ItemKey => _itemKey;
|
|
public EnvironmentKey EnvironmentKey => _environmentKey;
|
|
public PuzzleSlotKey PuzzleSlotKey => _puzzleSlotKey;
|
|
|
|
public string UniqueID
|
|
{
|
|
get
|
|
{
|
|
return _idType switch
|
|
{
|
|
ItemIdType.Pickup when _itemKey != ItemKey.None =>
|
|
ItemIDs.Get(_itemKey),
|
|
|
|
ItemIdType.Environment when _environmentKey != EnvironmentKey.None =>
|
|
ItemIDs.Get(_environmentKey),
|
|
|
|
ItemIdType.PuzzleSlot when _puzzleSlotKey != PuzzleSlotKey.None =>
|
|
ItemIDs.Get(_puzzleSlotKey),
|
|
|
|
_ => string.Empty
|
|
};
|
|
}
|
|
}
|
|
}
|
|
} |