NGUI实现分数增涨

来源:互联网 发布:虚拟主机linux 编辑:程序博客网 时间:2024/05/16 08:22
using UnityEngine;
using System.Collections;


public class PowerShow : MonoBehaviour {


    private float StartValue = 0; //开始的值
    private int EndValue = 1000; //终点的值


    private bool isStart = true; //是否开始
    private bool isAdd = true; //是否增涨


    public int Speed = 100;  //速度
    public UILabel Number_Label;






    void Update()
    {
        if(isStart)
        {
            if (isAdd)
            {
                StartValue += Speed * Time.deltaTime;
                
                if(StartValue>EndValue)
                {
                    isStart = false;
                }
            }
            else
            {
                StartValue -= Speed * Time.deltaTime;
                
                if (StartValue < EndValue)
                {
                    isStart = false;
                }

            }


            Number_Label.text = (int)StartValue + "";

        }


    }


}
0 0
原创粉丝点击