unity 利用ugui 制作技能冷却效果
2017-01-06 23:27
716 查看
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class SkillItem : MonoBehaviour { //冷却时间 public float coldTime = 2.0f; //定时器 private float timer = 0f; //前面的一张填充图片 private Image filedImage; //是否开始技能冷却 private bool isStartTimer = false; // Use this for initialization void Start () { filedImage = transform.Find ("FilledImage").GetComponent<Image> (); } // Update is called once per frame void Update () { //已经开始冷却 if (isStartTimer) { timer += Time.deltaTime; //计算fillAmount filedImage.fillAmount = (coldTime - timer) / coldTime; if (timer >= coldTime) { //停止定时器 filedImage.fillAmount = 0; timer = 0; isStartTimer = false; } } } public void OnClick() { isStartTimer = true; } }
相关文章推荐
- Unity学习——UGUI制作技能的冷却效果
- Unity制作技能冷却效果
- Unity 利用NGUI2.6.3做技能冷却的CD效果
- Unity 利用NGUI2.6.3做技能冷却的CD效果
- Unity 利用NGUI2.6.3做技能冷却的CD效果
- Unity3D 利用NGUI2.6.3做技能冷却的CD效果
- 技能冷却效果-[Unity]
- untiy 网格的应用—骰子的制作和技能冷却效果
- 使用Unity3D制作技能图标冷却效果
- 【分享】巧用CSS边框 制作技能冷却效果
- unity3d UGUI制作技能cd效果
- 技能冷却效果的制作
- 巧用CSS边框 制作技能冷却效果
- Unity之使用UGUI制作人物移动,血条跟随效果!
- NGUI制作技能冷却效果
- Silverlight 游戏开发小“.NET研究”技巧:技能冷却效果(Cooldown)
- 利用jquery制作图片经过放大效果
- 原创:利用JS制作GIF动画图(及图片轮转显示效果)
- 一起谈.NET技术,Silverlight 游戏开发小技巧:技能冷却效果(Cooldown)
- 一起谈.NET技术,Silverlight 游戏开发小技巧:技能冷却效果2(Cooldown)2