33 lines
649 B
C#
33 lines
649 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class ProgressBar : MonoBehaviour
|
||
|
{
|
||
|
public TMPro.TMP_Text Label;
|
||
|
public Slider Progress;
|
||
|
|
||
|
public void SetProgress(string task, float progress)
|
||
|
{
|
||
|
bool active = gameObject.activeSelf;
|
||
|
|
||
|
if(progress == 0 || progress == 1)
|
||
|
{
|
||
|
if (active)
|
||
|
{
|
||
|
gameObject.SetActive(false);
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (!active)
|
||
|
{
|
||
|
gameObject.SetActive(true);
|
||
|
}
|
||
|
|
||
|
Label.text = task;
|
||
|
Progress.value = progress;
|
||
|
}
|
||
|
}
|