コード例 #1
0
        /// <summary>
        /// Sets the value(s) for the specified time.
        /// </summary>
        /// <param name="skeleton">The skeleton.</param>
        /// <param name="time">The time.</param>
        /// <param name="alpha">The alpha.</param>
        public void Apply(Skeleton skeleton, float time, float alpha)
        {
            float[] frames = this.Frames;
            if (time < frames[0])
            {
                // Time is before first frame.
                return;
            }

            int frameIndex;
            if (time >= frames[frames.Length - 1])
            {
                // Time is after last frame.
                frameIndex = frames.Length - 1;
            }
            else
            {
                frameIndex = Animation.BinarySearch(frames, time, 1) - 1;
            }

            string attachmentName = this.AttachmentNames[frameIndex];
            skeleton.Slots[this.SlotIndex].Attachment = attachmentName == null ? null : skeleton.GetAttachment(this.SlotIndex, attachmentName);
        }