41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
|
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; }
|
||
|
|
||
|
public void Cooldown(float waitTime)
|
||
|
{
|
||
|
StartCoroutine(CooldownCoroutine(waitTime));
|
||
|
}
|
||
|
|
||
|
private void Start()
|
||
|
{
|
||
|
Fill.fillAmount = 0f;
|
||
|
}
|
||
|
|
||
|
public IEnumerator CooldownCoroutine(float waitTime)
|
||
|
{
|
||
|
Fill.fillAmount = 1f;
|
||
|
|
||
|
while (Fill.fillAmount > 0f)
|
||
|
{
|
||
|
Fill.fillAmount -= Time.deltaTime / waitTime;
|
||
|
yield return null;
|
||
|
}
|
||
|
|
||
|
Fade.Show();
|
||
|
}
|
||
|
}
|
||
|
}
|