Add Delivery Manager UI and UI logic

This commit is contained in:
BuyMyMojo 2023-03-03 03:54:19 +11:00
parent 8c5f4f2acf
commit 3ec46256e8
89 changed files with 14001 additions and 12 deletions

View file

@ -1,50 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ProgressBarUI : MonoBehaviour
{
[SerializeField] private GameObject hasProgressGameObject;
[SerializeField] private Image barImage;
private IHasProgress hasProgress;
private void Start()
{
hasProgress = hasProgressGameObject.GetComponent<IHasProgress>();
if (hasProgress == null) {
Debug.LogError("Game Object " + hasProgressGameObject + " does not have a componenet that implements IHasProgress!");
}
hasProgress.OnProgressChange += HasProgress_OnProgressChange;
barImage.fillAmount = 0f;
Hide();
}
private void HasProgress_OnProgressChange(object sender, IHasProgress.OnProgressChangeEventsArgs e)
{
barImage.fillAmount = e.progressNormalized;
if (e.progressNormalized == 0f || e.progressNormalized == 1f) {
Hide();
} else
{
Show();
}
}
private void Show()
{
gameObject.SetActive(true);
}
private void Hide()
{
gameObject.SetActive(false);
}
}