0f9b162061
- Add abstract dice system (IDie interface, DieDefinitionSO, StandardDieSO, DieInstance) to support future custom dice types while keeping backward compat via int[] DiceValues - Replace YachtCategory enum and CategoryScorer switch with CategoryDefinitionSO hierarchy: SumOfValueCategorySO, NOfAKindCategorySO, FullHouseCategorySO, StraightCategorySO, SumAllCategorySO - Add CategoryCatalogSO for ordered category collections and DiceCheckUtility for shared logic - Refactor ScoringSystem, Views, GameManager, GameController to use SO references - Update CategoryCondition modifier to use SO reference instead of enum - Update all editor tests to use SO-based categories and DieInstance Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using UnityEngine;
|
|
|
|
namespace YachtDice.Dice
|
|
{
|
|
/// <summary>
|
|
/// Абстрактное определение типа дайса.
|
|
/// Наследники описывают конкретные виды (стандартный d6, специальные и т.д.).
|
|
/// </summary>
|
|
public abstract class DieDefinitionSO : ScriptableObject
|
|
{
|
|
[Header("Identity")]
|
|
[SerializeField] private string id;
|
|
[SerializeField] private string displayName;
|
|
[SerializeField] private Sprite icon;
|
|
|
|
public string Id => id;
|
|
public string DisplayName => displayName;
|
|
public Sprite Icon => icon;
|
|
|
|
/// <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) where T : DieDefinitionSO
|
|
{
|
|
var so = CreateInstance<T>();
|
|
so.id = id;
|
|
so.displayName = displayName ?? id;
|
|
return so;
|
|
}
|
|
#endif
|
|
}
|
|
}
|