protected override void Add(AnimationComponent component, Node owner) { component.AnimationAdded += OnAnimationAdded; component.AnimationRemoved += OnAnimationRemoved; component.AnimationRun += OnAnimationRun; component.AnimationStopped += OnAnimationStopped; component.Depth = GetNodeDepth(owner); if (component.Depth >= currQueue.BucketCount) { BucketQueue <Animation> .Resize(ref currQueue, component.Depth + 1); BucketQueue <Animation> .Resize(ref nextQueue, component.Depth + 1); } if (owner.GloballyFrozen) { return; } foreach (var a in component.Animations) { if (a.IsRunning) { Activate(a); } } }
public static void Resize(ref BucketQueue <T> queue, int newBucketCount) { var newQueue = new BucketQueue <T>(newBucketCount); while (queue.Count > 0) { var bucketIndex = queue.Peek().BucketIndex; newQueue.Enqueue(bucketIndex, queue.Dequeue()); } queue = newQueue; }