cc.Class({
    extends: cc.Component,

    properties: {

    },
    start () {
        this.valueLabel = this.node.getComponent(cc.Label);
    },
    PlusOrMinusValue(currentValue,num)
    {
        // 以秒为单位的时间间隔
        let interval = 0.05;
        // 重复次数
        let repeat = 5;
        // 开始延时
        let delay = 0;

        //余数
        let remainder = num % repeat;
        //每次增值
        let perValue = (num-remainder)/repeat;

        let index = 0;

        this.schedule(function()
        {
            if(index==repeat-1)
            {
                currentValue = currentValue+perValue+remainder;
            }
            else
            {
                currentValue = currentValue+perValue;
            }

            this.valueLabel.string = currentValue;
            index++;
        }, interval, repeat-1, delay);
    }
});
