Project_WL/Assets/Script/HUD/HUDUI.cs

48 lines
1.2 KiB
C#

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;
public void Init(Actor _actor)
{
if (!gameObject.activeInHierarchy)
gameObject.SetActive(true);
m_Actor = _actor;
if (!m_Actor.IsRole(eRole.Summon)) OffTime = 5f;
HPSlider.fillRect.GetComponent<Image>().color = dic_Color[m_Actor.IsEnemy()];
TimeSlider.gameObject.SetActive(m_Actor.IsRole(eRole.Summon));
Set_Target(_actor.transform);
go_BossIcon.SetActive(_actor.IsSubRole(eSubRol.Boss));
}
public bool Get_Check()
{
if (DSUtil.CheckNull(m_Actor) || m_Actor.IsDead()) return true;
return false;
}
public void Set_HPSlider(Actor actor)
{
Init(actor);
HPSlider.value = actor.Get_HPPercent();
}
public void Set(Actor actor, float _remaintime)
{
Init(actor);
TimeSlider.value = _remaintime;
}
}