Files
YachtDice/Assets/Scripts/Dice/StandardDieSO.cs
T
horooko 0f9b162061 [Refactor] Replace hardcoded categories with data-driven SO system and abstract dice
- 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>
2026-03-01 11:46:50 +07:00

34 lines
1.1 KiB
C#

using UnityEngine;
namespace YachtDice.Dice
{
/// <summary>
/// Стандартный дайс с настраиваемыми значениями граней.
/// По умолчанию — классический d6 (1-6).
/// </summary>
[CreateAssetMenu(fileName = "StandardDie", menuName = "YachtDice/Dice/Standard Die")]
public class StandardDieSO : DieDefinitionSO
{
[Header("Configuration")]
[SerializeField] private int[] faceValues = { 1, 2, 3, 4, 5, 6 };
public override int FaceCount => faceValues.Length;
public override int[] GetFaceValues()
{
int[] copy = new int[faceValues.Length];
System.Array.Copy(faceValues, copy, faceValues.Length);
return copy;
}
#if UNITY_EDITOR
public static StandardDieSO CreateStandardD6ForTest()
{
var so = CreateForTest<StandardDieSO>("standard_d6", "Стандартный d6");
so.faceValues = new[] { 1, 2, 3, 4, 5, 6 };
return so;
}
#endif
}
}