Ngui _CD技能特效
2024-09-26 13:39:00
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;
}
}
}
}
最新文章
- Linux Shell 流程控制语句
- hibernate的三表查询
- XidianOJ 1063 Chemistry Problem
- [Linux]Linux下安装和配置solr/tomcat/IK分词器 详细实例二.
- Hibernate批量处理数据、HQL连接查询
- redis与memcache区别总结
- MySQL数据恢复和复制对InnoDB锁机制的影响
- Modbus工业协议在Android中的应用
- CAD的API们
- 复习URLHttpConnection方式GET,POST方式链接网络解析uri
- c++事件内核对象(event)进程间激活(转)
- HTTP/HTTPS自动加密上网方案
- Linux 统计文件夹下文件个数
- c# vs2010 winfrom控件检测网络环境
- [UOJ UR#16]破坏发射台
- ubuntu16.04安装lnmp环境
- linux用户身份和文件权限
- spring @Bean注解的使用
- 无法从项目中获取SSIS包的列表
- k64 datasheet学习笔记31---External Bus Interface (FlexBus)
热门文章
- 在mac平台运行debug.exe
- (二)backbone - DEMO - user list
- C语言中的memset函数和数组指针
- 火狐下<;a>;标签里嵌套的<;select>;不能选的bug
- requirejs的配置
- LUA 捕获模式 URL编码的例子解析
- python安装——Windows平台
- java生产者消费者并发协作
- ORA-07217: sltln: environment variable cannot be evaluated及RMAN-06059
- 《Programming WPF》翻译 第7章 4.转换