using System.Collections.Generic; using UnityEngine; /// /// Keep track off installed minigames /// [CreateAssetMenu(menuName = "Create new Scriptable/Minigame List")] public class MinigameList : ScriptableObject { /// /// Index of the active/to be loaded/current minigame /// public int currentMinigameIndex = 0; /// /// List of all installed minigames /// public List minigames = new List(); /// /// Get a minigame by MinigameIndex /// /// MinigameIndex of the minigame, each unique minigame has a unique MinigameIndex /// Minigame associated with this index, null if no minigame was found public Minigame GetMinigameByIndex(MinigameIndex minigameIndex) { return minigames.Find((m) => m.index == minigameIndex); } /// /// Function to find a minigame-index in the list based on its index /// /// public void SetCurrentMinigame(MinigameIndex index) { currentMinigameIndex = minigames.FindIndex((mi) => mi.index == index); } }