Files
YachtDice/Assets/Scripts/Dice/StandardDiсe.cs
T
2026-03-02 05:25:05 +07:00

34 lines
1.1 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;
namespace YachtDice.Dice
{
/// <summary>
/// Стандартный дайс с настраиваемыми значениями граней.
/// По умолчанию — классический d6 (1-6).
/// </summary>
[CreateAssetMenu(fileName = "StandardDice", menuName = "YachtDice/Dice/Standard Dice")]
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
}
}