64 lines
1.0 KiB
C#
64 lines
1.0 KiB
C#
using UnityEngine;
|
|
|
|
namespace UFS3
|
|
{
|
|
[CreateAssetMenu(fileName = "ItemData", menuName = "Data/ItemData")]
|
|
public abstract class BaseItemData : ScriptableObject
|
|
{
|
|
public int ID;
|
|
|
|
public int requiredLevel;
|
|
|
|
[SerializeField]
|
|
private Sprite icon;
|
|
|
|
[SerializeField]
|
|
private string description;
|
|
|
|
[SerializeField]
|
|
private float price;
|
|
|
|
[SerializeField]
|
|
private GameObject prefab;
|
|
|
|
[HideInInspector]
|
|
public int Width = 1;
|
|
|
|
[HideInInspector]
|
|
public int Height = 1;
|
|
|
|
public float weight;
|
|
|
|
public float Durabilty = 1f;
|
|
|
|
public Vector2Int GridPosition;
|
|
|
|
[SerializeField]
|
|
private ScriptableEventItemData OnUse;
|
|
|
|
public float Price => price;
|
|
|
|
public Vector2Int Size => new Vector2Int(Width, Height);
|
|
|
|
public string Description => description;
|
|
|
|
public Sprite Icon => icon;
|
|
|
|
public GameObject GetPrefab => prefab;
|
|
|
|
public abstract string StatisticText { get; }
|
|
|
|
public void Use()
|
|
{
|
|
if ((Object)(object)OnUse == null)
|
|
{
|
|
Debug.LogWarning("Empty event on baseitemdata");
|
|
}
|
|
else
|
|
{
|
|
OnUse.Raise(this);
|
|
}
|
|
}
|
|
}
|
|
}
|