using UnityEngine;
using System.Collections;

public class Skill : MonoBehaviour {
public float coldTime=2;//技能冷却时间
private UISprite sprite;
bool isColding=false;//标志位,判断技能是否在冷却。
// Use this for initialization
void Start () {
sprite = transform.Find ("Sprite").GetComponent<UISprite> ();//得到sprite上的UISprite组件。Unity编程,基本的套路就是得到组件,控制他身上的属性。

}

// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.A)&&isColding==false){
sprite.fillAmount=1;
isColding =true;
}
if(isColding){
sprite.fillAmount-= 1f/coldTime*Time.deltaTime;//计算每一帧要减去的东西。
if(sprite.fillAmount<=0){
sprite.fillAmount=0;
isColding=false;
}
}
}
}

最新文章

  1. Linux Shell 流程控制语句
  2. hibernate的三表查询
  3. XidianOJ 1063 Chemistry Problem
  4. [Linux]Linux下安装和配置solr/tomcat/IK分词器 详细实例二.
  5. Hibernate批量处理数据、HQL连接查询
  6. redis与memcache区别总结
  7. MySQL数据恢复和复制对InnoDB锁机制的影响
  8. Modbus工业协议在Android中的应用
  9. CAD的API们
  10. 复习URLHttpConnection方式GET,POST方式链接网络解析uri
  11. c++事件内核对象(event)进程间激活(转)
  12. HTTP/HTTPS自动加密上网方案
  13. Linux 统计文件夹下文件个数
  14. c# vs2010 winfrom控件检测网络环境
  15. [UOJ UR#16]破坏发射台
  16. ubuntu16.04安装lnmp环境
  17. linux用户身份和文件权限
  18. spring @Bean注解的使用
  19. 无法从项目中获取SSIS包的列表
  20. k64 datasheet学习笔记31---External Bus Interface (FlexBus)

热门文章

  1. 在mac平台运行debug.exe
  2. (二)backbone - DEMO - user list
  3. C语言中的memset函数和数组指针
  4. 火狐下&lt;a&gt;标签里嵌套的&lt;select&gt;不能选的bug
  5. requirejs的配置
  6. LUA 捕获模式 URL编码的例子解析
  7. python安装——Windows平台
  8. java生产者消费者并发协作
  9. ORA-07217: sltln: environment variable cannot be evaluated及RMAN-06059
  10. 《Programming WPF》翻译 第7章 4.转换