[Add] Data
This commit is contained in:
@@ -10,22 +10,22 @@ namespace YachtDice.Game
|
||||
[SerializeField] private List<DiceRoller> diceRollers = new();
|
||||
|
||||
public event Action OnAllDiceSettled;
|
||||
public event Action<int, int> OnDieSettled;
|
||||
public event Action<int, int> OnDiceSettled;
|
||||
|
||||
public int DiceCount => diceRollers.Count;
|
||||
|
||||
private DieInstance[] diceInstances;
|
||||
private DiceInstance[] diceInstances;
|
||||
private int pendingCount;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
int count = diceRollers.Count;
|
||||
diceInstances = new DieInstance[count];
|
||||
diceInstances = new DiceInstance[count];
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var definition = diceRollers[i].Definition;
|
||||
diceInstances[i] = new DieInstance(definition);
|
||||
diceInstances[i] = new DiceInstance(definition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace YachtDice.Game
|
||||
{
|
||||
diceRollers[capturedIndex].OnRollFinished -= Handler;
|
||||
diceInstances[capturedIndex].Value = value;
|
||||
OnDieSettled?.Invoke(capturedIndex, value);
|
||||
OnDiceSettled?.Invoke(capturedIndex, value);
|
||||
|
||||
pendingCount--;
|
||||
if (pendingCount <= 0)
|
||||
@@ -81,7 +81,7 @@ namespace YachtDice.Game
|
||||
}
|
||||
|
||||
/// <summary>Возвращает абстрактный список дайсов (основной API).</summary>
|
||||
public IReadOnlyList<IDie> GetDice() => diceInstances;
|
||||
public IReadOnlyList<IDice> GetDice() => diceInstances;
|
||||
|
||||
/// <summary>Возвращает копию текущих значений (обратная совместимость).</summary>
|
||||
public int[] GetCurrentValues()
|
||||
|
||||
Reference in New Issue
Block a user