Project_WL/Assets/Script/UI/BossInfoUI.cs

25 lines
571 B
C#
Raw Permalink Normal View History

2024-12-15 01:39:39 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BossInfoUI : MonoBehaviour
{
public UILabel label_bossname;
public UISlider slider_bosshp;
public void Set(string _bossname = null)
{
var active = !string.IsNullOrEmpty(_bossname);
gameObject.SetActive(active);
if (active)
{
Set_HP(1, 1);
label_bossname.text = _bossname;
}
}
public void Set_HP(double _hp, double _maxhp)
{
slider_bosshp.value = (float)(_hp / _maxhp);
}
}