Beispiel #1
0
 public void play(int loop,
                  bool backwards          = false,
                  callback0 onComplete    = null,
                  int eventIdx            = -1,
                  callback1 <int> onEvent = null)
 {
     play(new Vector2(0, _spriteList.Length - 1), loop, backwards, onComplete, eventIdx, onEvent);
 }
Beispiel #2
0
    public void play(Vector2 range,
                     int loop,
                     bool backwards          = false,
                     callback0 onComplete    = null,
                     int eventIdx            = -1,
                     callback1 <int> onEvent = null)
    {
        _curRange   = range;
        _targetLoop = loop;
        _onComplete = onComplete;
        _eventIdx   = eventIdx;
        _onEvent    = onEvent;
        if (_spr == null)
        {
            _spr = gameObject.GetComponent <Image>();
        }

        if (backwards)
        {
            _curUpdateCount = playBackwardsUpdate;
        }
        else
        {
            _curUpdateCount = playForwardUpdate;
        }

        if (loop == -1)
        {
            loop = int.MaxValue;
        }
        _targetLoop      = loop;
        _loopCount       = 0;
        _startFrameCount = Time.frameCount;
        curFrameIdx      = (int)_curRange.x;

        if (!_isPlaying)
        {
            TimerManager.instance.addEventListeners(this);
        }
        else
        {
            _isPlaying = true;
        }
    }