revival/game/Assets/Scripts/UI/PlayerUI.cs

24 lines
544 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerUI : MonoBehaviour
{
[SerializeField]
private Image cooldownImage;
private float cooldownTimer = 0f;
public void updateCooldownUI(float rawCooldownTimer, float regenerateTime)
{
if (rawCooldownTimer <= 0)
cooldownTimer = 0;
else
cooldownTimer = Mathf.Round(rawCooldownTimer) / regenerateTime;
cooldownImage.fillAmount = cooldownTimer;
}
}