[Refactor] Replace [SerializeField] + getter with [field: SerializeField] auto-properties

This commit is contained in:
2026-03-01 21:29:47 +07:00
parent 30f9532fd7
commit ddc3b4af47
13 changed files with 38 additions and 38 deletions
+33
View File
@@ -0,0 +1,33 @@
using UnityEngine;
namespace YachtDice.Dice
{
/// <summary>
/// Стандартный дайс с настраиваемыми значениями граней.
/// По умолчанию — классический d6 (1-6).
/// </summary>
[CreateAssetMenu(fileName = "StandardDie", menuName = "YachtDice/Dice/Standard Die")]
public class StandardDiсe : DiсeDefinition
{
[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 StandardDiсe CreateStandardD6ForTest()
{
var so = CreateForTest<StandardDiсe>("standard_d6", "Стандартный d6");
so.faceValues = new[] { 1, 2, 3, 4, 5, 6 };
return so;
}
#endif
}
}