Пример #1
0
    public TimerActObj StartTimer(float time, System.Action act, int repeatTime = -1)
    {
        TimerActObj obj = null;

        if (_recircleActlib.Count > 0)
        {
            obj = _recircleActlib[_recircleActlib.Count - 1];
            _recircleActlib.RemoveAt(_recircleActlib.Count - 1);
            obj.Timer      = time;
            obj.Act        = act;
            obj.repeatTime = repeatTime;
        }
        else
        {
            obj = new TimerActObj(time, act, this, repeatTime);
        }
        if (!TimerActLib.Contains(obj))
        {
            this.TimerActLib.Add(obj);
            obj.StartTimer();
        }
        else
        {
        }
        return(obj);
    }
Пример #2
0
    public void StopTimer(TimerActObj value)
    {
        var obj = value;

        if (obj != null)
        {
            obj.Clear();
        }
    }