示例#1
0
    private static void OnComplete(AnimationItem completedItem)
    {
        if (queue.Count == 0)
        {
            return;
        }
        AnimationItem item = queue[0];

        if (item.id != completedItem.id)
        {
            completedItem.complete = true;
        }
        else
        {
            queue.RemoveAt(0);
            if (queue.Count > 0 && !queue[0].isRunning)
            {
                AnimationItem nextItem = queue[0];
                nextItem.StartAnimation();
                if (nextItem.complete)
                {
                    AnimationQueue.OnComplete(nextItem);
                }
            }
        }
    }
示例#2
0
    // Add wait time override for simultaneous animations?
    public static Action Add(Action StartAnimation, float wait = 0)
    {
        Action        OnComplete = () => AnimationQueue.OnComplete(nextId);
        AnimationItem item       = new AnimationItem(nextId, StartAnimation);

        queue.Add(item);
        nextId++;

        if (queue.Count == 1)
        {
            item.StartAnimation();
        }
        if (wait != 0)
        {
            Timer.TimeoutAction(OnComplete, wait);
        }
        return(OnComplete);
    }