diff --git a/Assets/Scripts/Minigames/CardSorting/UI/LivesDisplay.cs b/Assets/Scripts/Minigames/CardSorting/UI/LivesDisplay.cs index ee2c89c0..2e516f52 100644 --- a/Assets/Scripts/Minigames/CardSorting/UI/LivesDisplay.cs +++ b/Assets/Scripts/Minigames/CardSorting/UI/LivesDisplay.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using Core.Lifecycle; using UnityEngine; using UnityEngine.UI; @@ -9,7 +10,7 @@ namespace Minigames.CardSorting.UI /// Displays and animates lives for the card sorting minigame. /// Manages a layout group of life icons with add/remove animations. /// - public class LivesDisplay : MonoBehaviour + public class LivesDisplay : ManagedBehaviour { [Header("Configuration")] [SerializeField] private LayoutGroup layoutGroup; @@ -21,7 +22,11 @@ namespace Minigames.CardSorting.UI private GameObject lifeIconPrefab; private List lifeIcons = new List(); - private void Awake() + /// + /// Initialize the display with the maximum number of lives. + /// Clones the prefab element multiple times. + /// + public void Initialize(int maxLives) { if (layoutGroup == null) { @@ -33,14 +38,7 @@ namespace Minigames.CardSorting.UI { lifeIconPrefab = layoutGroup.transform.GetChild(0).gameObject; } - } - - /// - /// Initialize the display with the maximum number of lives. - /// Clones the prefab element multiple times. - /// - public void Initialize(int maxLives) - { + // Clear existing lives ClearAllLives();