Example #1
0
    public void executeEvent(TimelineEvent e)
    {
        if (myQProcessingEvent)
        {
            Debug.LogError("Never execute an event from inside a do()");
            return;
        }

        myEvents.Add(e);
        myQProcessingEvent = true;
        e.Do(this);
        myQProcessingEvent = false;
        _executeDelay      = e.Act();
    }
Example #2
0
    IEnumerator processEvents()
    {
        while (true)
        {
            if (_executeDelay > 0)
            {
                yield return(new WaitForSeconds(_executeDelay));

                _executeDelay = 0;
            }
            if (myPendingEvents.Count > 0)
            {
                myQReady = false;
                TimelineEvent e = myPendingEvents.Pop(0);
                myEvents.Add(e);

                myQProcessingEvent = true;
                try { e.Do(this); }
                catch (Exception exception)
                {
                    Debug.LogException(exception);
                }
                myQProcessingEvent = false;
                float delay = e.Act();
                if (delay > 0)
                {
                    yield return(new WaitForSeconds(delay));
                }
            }
            else
            {
                myQReady = true;
            }
            yield return(new WaitForEndOfFrame());
        }
    }