代码如下:
using UnityEngine;
using System.Collections;
public class Skill_Cooling: MonoBehaviour {
public UISprite sprite;
bool state = false;
// Use this for initialization
void Start () {
sprite= sprite.GetComponent<UISprite>();
}
// Update is called once per frame
void Update () {
if (state)
{
sprite.fillAmount -= 0.001f;
if (sprite.fillAmount == 0)
{
sprite.fillAmount = 1f;
state = false;
sprite.gameObject.SetActive(false);
}
}
}
void OnClick()
{
sprite.gameObject.SetActive(true);
state = true;
Debug.Log("你点击了按钮!!!");
}
}