效果
代码
using UnityEngine; using System.Collections; public class SkillControl : 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.01f; if(sprite.fillAmount==0) { sprite.fillAmount=1f; state=false; } } } void OnClick(GameObject btn) { if(btn.name=="skill") { state = true; } } }