Project_WL/Assets/Script/HUD/HUDUI.cs

48 lines
1.2 KiB
C#
Raw Normal View History

2024-12-15 01:39:39 +00:00
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HUDUI : HUDBase
{
public Slider HPSlider, TimeSlider;
public GameObject go_BossIcon;
static Dictionary<bool, Color> dic_Color = new Dictionary<bool, Color>
{
{ false, new Color32(88, 236, 255, 255) },
{ true, new Color32(230, 52, 23, 255) },
};
Actor m_Actor;
2025-03-05 03:47:01 +00:00
public void Init(Actor _actor)
2024-12-15 01:39:39 +00:00
{
2025-03-05 03:47:01 +00:00
if (!gameObject.activeInHierarchy)
gameObject.SetActive(true);
2024-12-15 01:39:39 +00:00
m_Actor = _actor;
2025-03-05 03:47:01 +00:00
if (!m_Actor.IsRole(eRole.Summon)) OffTime = 5f;
2024-12-15 01:39:39 +00:00
HPSlider.fillRect.GetComponent<Image>().color = dic_Color[m_Actor.IsEnemy()];
TimeSlider.gameObject.SetActive(m_Actor.IsRole(eRole.Summon));
2025-03-05 03:47:01 +00:00
Set_Target(_actor.transform);
go_BossIcon.SetActive(_actor.IsSubRole(eSubRol.Boss));
2024-12-15 01:39:39 +00:00
}
2025-01-27 04:37:33 +00:00
public bool Get_Check()
{
2025-03-05 03:47:01 +00:00
if (DSUtil.CheckNull(m_Actor) || m_Actor.IsDead()) return true;
2025-01-27 04:37:33 +00:00
return false;
}
2025-03-05 03:47:01 +00:00
public void Set_HPSlider(Actor actor)
2024-12-15 01:39:39 +00:00
{
2025-03-05 03:47:01 +00:00
Init(actor);
HPSlider.value = actor.Get_HPPercent();
2024-12-15 01:39:39 +00:00
}
2025-03-05 03:47:01 +00:00
public void Set(Actor actor, float _remaintime)
2024-12-15 01:39:39 +00:00
{
2025-03-05 03:47:01 +00:00
Init(actor);
2024-12-15 01:39:39 +00:00
TimeSlider.value = _remaintime;
}
}