50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
|
|
using System.Collections;
|
||
|
|
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, Transform _target)
|
||
|
|
{
|
||
|
|
m_Actor = _actor;
|
||
|
|
gameObject.SetActive(false);
|
||
|
|
|
||
|
|
HPSlider.fillRect.GetComponent<Image>().color = dic_Color[m_Actor.IsEnemy()];
|
||
|
|
TimeSlider.value = 1f;
|
||
|
|
TimeSlider.gameObject.SetActive(m_Actor.IsRole(eRole.Summon));
|
||
|
|
Set_Target(_target);
|
||
|
|
go_BossIcon.SetActive(_actor.IsRole(eRole.Boss));
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Set_HPSlider(double Hp, double MaxHp)
|
||
|
|
{
|
||
|
|
On_HUD();
|
||
|
|
HPSlider.value = (float)(Hp / MaxHp);
|
||
|
|
}
|
||
|
|
public void Set(float _remaintime)
|
||
|
|
{
|
||
|
|
On_HUD();
|
||
|
|
TimeSlider.value = _remaintime;
|
||
|
|
}
|
||
|
|
|
||
|
|
void On_HUD()
|
||
|
|
{
|
||
|
|
if (!gameObject.activeInHierarchy)
|
||
|
|
gameObject.SetActive(true);
|
||
|
|
|
||
|
|
if (IsInvoking("Off")) CancelInvoke("Off");
|
||
|
|
Invoke("Off", 5f);
|
||
|
|
}
|
||
|
|
}
|