现在的位置: 首页 > 综合 > 正文

NGUI做技能冷却

2014年09月13日 ⁄ 综合 ⁄ 共 398字 ⁄ 字号 评论关闭

效果

代码

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;
		}
	}
}
【上篇】
【下篇】

抱歉!评论已关闭.