56 lines
1.2 KiB
C#
56 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using KitsuneCafe.SOAP;
|
|
using KitsuneCafe.Sys.Attributes;
|
|
using UnityEngine;
|
|
|
|
namespace KitsuneCafe.ItemSystem
|
|
{
|
|
public abstract class BaseItem : ScriptableObject, IItem
|
|
{
|
|
[SerializeField]
|
|
private string id;
|
|
public string Id => id;
|
|
|
|
[SerializeField]
|
|
private string displayName;
|
|
public string DisplayName => displayName;
|
|
|
|
[SerializeField, TextArea]
|
|
private string description;
|
|
public string Description => description;
|
|
|
|
[SerializeField]
|
|
private Sprite icon;
|
|
public Sprite Icon => icon;
|
|
|
|
[SerializeField]
|
|
private List<StringConstant> tags;
|
|
public IReadOnlyCollection<StringConstant> Tags => tags;
|
|
|
|
[SerializeField]
|
|
private GameObject worldPrefab;
|
|
|
|
[SerializeField]
|
|
private GameObject previewPrefab;
|
|
|
|
[Button("Generate New ID")]
|
|
protected void GenerateNewId()
|
|
{
|
|
id = Guid.NewGuid().ToString();
|
|
#if UNITY_EDITOR
|
|
UnityEditor.EditorUtility.SetDirty(this);
|
|
#endif
|
|
}
|
|
|
|
public GameObject CreateInstance()
|
|
{
|
|
return Instantiate(worldPrefab);
|
|
}
|
|
|
|
public GameObject CreatePreview()
|
|
{
|
|
return Instantiate(previewPrefab);
|
|
}
|
|
}
|
|
}
|