66 lines
2.2 KiB
C#
66 lines
2.2 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using YachtDice.Modifiers.Core;
|
|
|
|
namespace YachtDice.Modifiers.Definition
|
|
{
|
|
[CreateAssetMenu(fileName = "NewModifier", menuName = "YachtDice/Modifiers/Definition")]
|
|
public class ModifierDefinition : ScriptableObject
|
|
{
|
|
[Header("Identity")]
|
|
[SerializeField] private string id;
|
|
[SerializeField] private string displayName;
|
|
[SerializeField, TextArea] private string description;
|
|
[SerializeField] private Sprite icon;
|
|
[SerializeField] private ModifierRarity rarity;
|
|
|
|
[Header("Economy")]
|
|
[SerializeField] private int shopPrice;
|
|
[SerializeField] private int sellPrice;
|
|
|
|
[Header("Durability")]
|
|
[SerializeField] private bool hasLimitedUses;
|
|
[SerializeField] private int maxUses;
|
|
[SerializeField] private int maxStacks = 1;
|
|
|
|
[Header("Behaviors")]
|
|
[SerializeField] private List<ModifierBehavior> behaviors = new();
|
|
|
|
public string Id => id;
|
|
public string DisplayName => displayName;
|
|
public string Description => description;
|
|
public Sprite Icon => icon;
|
|
public ModifierRarity Rarity => rarity;
|
|
public int ShopPrice => shopPrice;
|
|
public int SellPrice => sellPrice;
|
|
public bool HasLimitedUses => hasLimitedUses;
|
|
public int MaxUses => maxUses;
|
|
public int MaxStacks => maxStacks;
|
|
public IReadOnlyList<ModifierBehavior> Behaviors => behaviors;
|
|
|
|
#if UNITY_EDITOR
|
|
public static ModifierDefinition CreateForTest(
|
|
string id,
|
|
List<ModifierBehavior> behaviors,
|
|
bool hasLimitedUses = false,
|
|
int maxUses = 0,
|
|
int shopPrice = 100,
|
|
int sellPrice = 50,
|
|
ModifierRarity rarity = ModifierRarity.Common)
|
|
{
|
|
var so = CreateInstance<ModifierDefinition>();
|
|
so.id = id;
|
|
so.displayName = id;
|
|
so.description = id;
|
|
so.rarity = rarity;
|
|
so.shopPrice = shopPrice;
|
|
so.sellPrice = sellPrice;
|
|
so.hasLimitedUses = hasLimitedUses;
|
|
so.maxUses = maxUses;
|
|
so.behaviors = behaviors ?? new List<ModifierBehavior>();
|
|
return so;
|
|
}
|
|
#endif
|
|
}
|
|
}
|