/* * ------------------------------------------------------------------------ * Description: This class handles the ui system * Author: Eli Simpkins-Simmonds * ------------------------------------------------------------------------ */ using UnityEngine; using UnityEngine.UI; public class UIManager : MonoBehaviour { public Image segment1; // UI Image for the first segment of the loading bar public Image segment2; // UI Image for the second segment of the loading bar public Image segment3; // UI Image for the third segment of the loading bar void Start() { ResetLoadingBar(); // Initialize the loading bar to its default state } public void UpdateLoadingBar(int itemsCollected) { ResetLoadingBar(); // Reset the loading bar before updating if (itemsCollected >= 1) { segment1.enabled = true; // Enable the first segment if at least one item is collected } if (itemsCollected >= 3) { segment2.enabled = true; // Enable the second segment when 4 items are collected } if (itemsCollected >= 5) { segment3.enabled = true; // Enable the third segment when 6 s are collected } } public void ResetLoadingBar() { segment1.enabled = false; // Disable the first segment segment2.enabled = false; // Disable the second segment segment3.enabled = false; // Disables the third segment } }