Ejemplo n.º 1
0
        public Clip GetClip(string clipName)
        {
            if (!HasClip(clipName))
            {
                throw new Exception("The clip " + clipName + " does not exist on this animator");
            }

            var clipIndex = GetClipIndex(clipName);            //clipNames.IndexOf(clipName);

            var clip = new Clip
            {
                FPS       = clipFPSs[clipIndex],
                LoopStart = clipLoopStarts[clipIndex],
                Name      = clipName,
                WrapMode  = clipWrapModes[clipIndex]
            };

            var frameStart = clipFrameStartIndexes[clipIndex];
            var frameCount = clipFrameCounts[clipIndex];

            //Debug.Log("Frames_A = " + clip.Frames);
            //Debug.Log("Frame Count = " + frameCount);

            for (int i = frameStart; i < frameStart + frameCount; i++)
            {
                clip.AddFrame(frames[i]);
            }
            return(clip);
        }