using System.Collections.Generic; using UnityEngine; namespace YachtDice.Dice { [CreateAssetMenu(fileName = "DiceCatalog", menuName = "YachtDice/Dice/Catalog")] public class DiceCatalog : ScriptableObject { [SerializeField] private List dice = new(); public IReadOnlyList All => dice; public DiceDefinitionSO FindById(string id) { for (int i = 0; i < dice.Count; i++) { if (dice[i] != null && dice[i].Id == id) return dice[i]; } return null; } #if UNITY_EDITOR public static DiceCatalog CreateForTest(List defs) { var catalog = CreateInstance(); catalog.dice = defs ?? new List(); return catalog; } #endif } }