Add cutting progress bar

This commit is contained in:
BuyMyMojo 2023-03-01 04:08:49 +11:00
parent 8194937cd8
commit 4ad7bf281c
8 changed files with 761 additions and 42 deletions

View file

@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ProgressBarUI : MonoBehaviour
{
[SerializeField] private CuttingCounter cuttingCounter;
[SerializeField] private Image barImage;
private void Start()
{
cuttingCounter.OnProgressChange += CuttingCounter_OnProgressChange;
barImage.fillAmount = 0f;
Hide();
}
private void CuttingCounter_OnProgressChange(object sender, CuttingCounter.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);
}
}