f6c354d41c
Convert serialized private fields with public arrow getters to [field: SerializeField] auto-properties across ScriptableObjects (DieDefinitionSO, CategoryDefinition, ModifierDefinition, Effect, ModifierBehavior, SumOfValueCategory) and select MonoBehaviours (DiceRoller, Dice.Entry struct). Fields with type-changing getters (List→IReadOnlyList) or computed getters are intentionally kept as-is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
1.6 KiB
C#
43 lines
1.6 KiB
C#
using UnityEngine;
|
|
using YachtDice.Shop;
|
|
|
|
namespace YachtDice.Dice
|
|
{
|
|
/// <summary>
|
|
/// Абстрактное определение типа дайса.
|
|
/// Наследники описывают конкретные виды (стандартный d6, специальные и т.д.).
|
|
/// </summary>
|
|
public abstract class DieDefinitionSO : ScriptableObject, IShopItem
|
|
{
|
|
[field: Header("Identity")]
|
|
[field: SerializeField] public string Id { get; private set; }
|
|
[field: SerializeField] public string DisplayName { get; private set; }
|
|
[field: SerializeField, TextArea] public string Description { get; private set; }
|
|
[field: SerializeField] public Sprite Icon { get; private set; }
|
|
|
|
[field: Header("Economy")]
|
|
[field: SerializeField] public int ShopPrice { get; private set; }
|
|
|
|
public bool IsRepurchasable => false;
|
|
|
|
/// <summary>Количество граней.</summary>
|
|
public abstract int FaceCount { get; }
|
|
|
|
/// <summary>Возвращает массив всех возможных значений граней.</summary>
|
|
public abstract int[] GetFaceValues();
|
|
|
|
#if UNITY_EDITOR
|
|
public static T CreateForTest<T>(string id, string displayName = null,
|
|
int shopPrice = 0, string description = null) where T : DieDefinitionSO
|
|
{
|
|
var so = CreateInstance<T>();
|
|
so.Id = id;
|
|
so.DisplayName = displayName ?? id;
|
|
so.Description = description ?? id;
|
|
so.ShopPrice = shopPrice;
|
|
return so;
|
|
}
|
|
#endif
|
|
}
|
|
}
|