当前位置:网站首页>NGUI,冷却效果

NGUI,冷却效果

2022-06-11 10:20:00 ying1228475251

bool flag=false;
    void Start () {
        cool= transform.GetChild(2).transform.GetChild(0).GetComponent<UISprite>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A)&&flag==false)
        {
            flag = true;
            cool.fillAmount =1;
        }

        if (flag)
        {
            cool.fillAmount -= Time.deltaTime*0.3f;
            if (cool.fillAmount<=0)
            {
                flag = false;
                cool.fillAmount = 0;
            }
        }

    }

原网站

版权声明
本文为[ying1228475251]所创,转载请带上原文链接,感谢
https://blog.csdn.net/ying1228475251/article/details/125206564