Files
Gen_Hack-and-Slash-Roguelit…/Client/Assets/Scripts/UI/PlayerStateUI.cs

24 lines
611 B
C#
Raw Normal View History

using System;
2025-08-26 16:00:58 +08:00
using TMPro;
using UnityEngine;
namespace UI
{
public class PlayerStateUI:MonoBehaviour,Base.ITick
{
[SerializeField] private BarUI focusedEntityHP;
[SerializeField] private BarUI lastEntityHP;
2025-08-26 16:00:58 +08:00
public void Tick()
{
var focusedEntity = Program.Instance.FocusedEntity;
if (focusedEntity && focusedEntity.entityDef != null)
2025-08-26 16:00:58 +08:00
{
focusedEntityHP.Progress =
(float)focusedEntity.attributes.health / focusedEntity.entityDef.attributes.health;
2025-08-26 16:00:58 +08:00
}
}
2025-08-26 16:00:58 +08:00
}
}