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

24 lines
544 B
C#
Raw Normal View History

2021-03-13 03:01:20 +01:00
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;
}
}