using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class SkillCD : MonoBehaviour {
private Image image;
public float CD_time = 2f;
private float timer = 0f;
private bool isStart = false;
void Start () {
image = transform.Find("cover").GetComponent<Image>();
}
void Update () {
if (Input.GetKeyDown(KeyCode.Q))
{
isStart = true;
}
if (isStart)
{
timer += Time.deltaTime;
image.fillAmount = (CD_time-timer)/ CD_time;
if (timer>=CD_time)
{
image.fillAmount = 0;
timer = 0;
isStart = false;
}
}
}
public void Onclick()
{
isStart = true;
}
}
技能CD控制
最新推荐文章于 2021-11-29 21:38:58 发布