컴퓨터 수정
This commit is contained in:
41
Assets/02_Scripts/UI/computer/MainProgressUI.cs
Normal file
41
Assets/02_Scripts/UI/computer/MainProgressUI.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user