Пример #1
0
    public static TimeItem Init(CallBackFun fun, CallBackRemoveFun rf, float intervalTime, int time)
    {
        if (_obj == null)
        {
            _obj = GameObject.Find("Timer");
        }
        TimeItem ins = _obj.AddComponent <TimeItem>();

        ins.id        = UID++;
        ins.fun       = fun;
        ins.removeFun = rf;
        ins.total     = time;
        ins.cur       = 0;
        ins.InvokeRepeating("back", intervalTime, intervalTime);
        ins.isStop = false;
        return(ins);
    }