Files
YachtDice/Assets/Scripts/Dice/DiсeDefinition.cs
T
horooko 06a75436fe Merge branch 'claude/vibrant-tereshkova'
# Conflicts:
#	Assets/Scripts/Dice/DiceRoller.cs
2026-03-01 21:30:39 +07:00

43 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
using YachtDice.Shop;
namespace YachtDice.Dice
{
/// <summary>
/// Абстрактное определение типа дайса.
/// Наследники описывают конкретные виды (стандартный d6, специальные и т.д.).
/// </summary>
public abstract class DiсeDefinition : 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 : DiсeDefinition
{
var so = CreateInstance<T>();
so.Id = id;
so.DisplayName = displayName ?? id;
so.Description = description ?? id;
so.ShopPrice = shopPrice;
return so;
}
#endif
}
}