41 lines
850 B
C#
41 lines
850 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
|
|
public class MainProgressUI : MonoBehaviour
|
|
{
|
|
[Header("진행도 채움 이미지")]
|
|
public Image progressFill;
|
|
|
|
[Header("퍼센트 텍스트")]
|
|
public TMP_Text percentText;
|
|
|
|
[Header("메인 진행도")]
|
|
[Range(0, 100)]
|
|
public int progressPercent = 0;
|
|
|
|
private void Start()
|
|
{
|
|
SetProgress(progressPercent);
|
|
}
|
|
|
|
public void SetProgress(int percent)
|
|
{
|
|
progressPercent = Mathf.Clamp(percent, 0, 100);
|
|
|
|
if (progressFill != null)
|
|
{
|
|
progressFill.fillAmount = progressPercent / 100f;
|
|
}
|
|
|
|
if (percentText != null)
|
|
{
|
|
percentText.text = progressPercent + "%";
|
|
}
|
|
}
|
|
|
|
public void AddProgress(int amount)
|
|
{
|
|
SetProgress(progressPercent + amount);
|
|
}
|
|
} |