public void ClearTrack(int trackIndex)
        {
            if (trackIndex >= tracks.Count)
            {
                return;
            }
            TrackEntry current = tracks[trackIndex];

            if (current == null)
            {
                return;
            }

            current.OnEnd(this, trackIndex);
            if (End != null)
            {
                End(this, trackIndex);
            }

            tracks[trackIndex] = null;
        }
        private void SetCurrent(int index, TrackEntry entry)
        {
            TrackEntry current = ExpandToIndex(index);

            if (current != null)
            {
                TrackEntry previous = current.previous;
                current.previous = null;

                current.OnEnd(this, index);
                if (End != null)
                {
                    End(this, index);
                }

                entry.mixDuration = data.GetMix(current.animation, entry.animation);
                if (entry.mixDuration > 0)
                {
                    entry.mixTime = 0;
                    // If a mix is in progress, mix from the closest animation.
                    if (previous != null && current.mixTime / current.mixDuration < 0.5f)
                    {
                        entry.previous = previous;
                    }
                    else
                    {
                        entry.previous = current;
                    }
                }
            }

            tracks[index] = entry;

            entry.OnStart(this, index);
            if (Start != null)
            {
                Start(this, index);
            }
        }