Files
butchers-games-test/Assets/Scripts/Game/Player/PlayerGauge.cs
T
Boris Nikolaev 5f1e94b653 add project files
2026-08-14 01:58:31 +03:00

53 lines
1.1 KiB
C#

using UnityEngine;
using OHM.UnityToolkit.UI;
using UnityEngine.Serialization;
public class PlayerGauge : CoreBehaviour
{
[SerializeField]
[FormerlySerializedAs("progressionGauge")]
private UIIncrementableGauge _progressionGauge;
[SerializeField]
[FormerlySerializedAs("statusTxt")]
private SizePrefabUI _statusTxt;
[SerializeField]
[FormerlySerializedAs("animGauge")]
private Animator _animGauge;
public void UpdateGauge(int v, bool force = false)
{
float value = (float)v / (float)base.CoreDef.player.maxValueRich;
if (force)
{
_progressionGauge.QuickResetToLevel(0, value, force: true);
}
else
{
_progressionGauge.SetTargetValue(value, 0);
}
}
public void ChangeStatus(string locKey, Color color)
{
_statusTxt.SetText(locKey, color);
_progressionGauge.changeGaugeColor(color);
}
public void ActiveGauge(bool active)
{
base.gameObject.SetActive(active);
}
public void ActiveDanger(bool active)
{
_animGauge.SetBool("Danger", active);
}
public void ActiveMax(bool active)
{
_animGauge.SetBool("Max", active);
}
}