using System; using System.Collections; using Doozy.Runtime.UIManager.Containers; using UnityEngine; using UnityEngine.UI; // ReSharper disable once CheckNamespace namespace BlueWaterProject { [Serializable] public class SkillUi : MonoBehaviour { [field: SerializeField] public GameObject Obj { get; set; } [field: SerializeField] public Image Icon { get; set; } [field: SerializeField] public Image Fill { get; set; } [field: SerializeField] public UIView Fade { get; set; } private Coroutine cooldownCoroutine; private void Start() { Fill.fillAmount = 0f; } public void Cooldown(float waitTime) { cooldownCoroutine = StartCoroutine(CooldownCoroutine(waitTime)); } private IEnumerator CooldownCoroutine(float waitTime) { Fill.fillAmount = 1f; while (Fill.fillAmount > 0f) { Fill.fillAmount -= Time.deltaTime / waitTime; yield return null; } Fade.Show(); } public void ResetSkillUi() { if (cooldownCoroutine != null) { StopCoroutine(cooldownCoroutine); cooldownCoroutine = null; } Fill.fillAmount = 0f; } } }