/// <summary>Interpolates the objects of firstFrame and secondFrame.</summary>
        /// <remarks>Interpolates the objects of firstFrame and secondFrame.</remarks>
        /// <param name="currentFrame"></param>
        /// <param name="nextFrame"></param>
        /// <param name="xOffset"></param>
        /// <param name="yOffset"></param>
        protected internal virtual void transformObjects(SpriterKeyFrame
			 currentFrame, SpriterKeyFrame nextFrame, float
			 xOffset, float yOffset)
        {
            this.rect.set(xOffset, yOffset, xOffset, yOffset);
            if (!this.updateObjects)
            {
                return;
            }
            this.updateTransformedTempObjects(nextFrame.getObjects(), this.tempObjects2);
            this.updateTempObjects(currentFrame.getObjects(), this.nonTransformedTempObjects);
            for (int i = 0; i < this.currenObjectsToDraw; i++)
            {
                if (this.tempObjects[i].active)
                {
                    this.tweenObject(this.nonTransformedTempObjects[i], nextFrame.getObjectFor(this.nonTransformedTempObjects
                        [i]), i, currentFrame.getTime(), nextFrame.getTime());
                }
            }
        }
        /// <summary>Generates all needed keyframes from the given spriter data.</summary>
        /// <remarks>Generates all needed keyframes from the given spriter data. This method sorts all objects by its z_index value to draw them in a proper way.
        /// 	</remarks>
        /// <param name="spriterData">SpriterData to generate from.</param>
        /// <returns>generated keyframe list.</returns>
        public static IList<SpriterAnimation> generateKeyFramePool(com.discobeard.spriter.dom.SpriterData data, com.discobeard.spriter.dom.Entity
			 entity)
        {
            IList<SpriterAnimation
                > spriterAnimations = new List<SpriterAnimation
                >();
            IList<com.discobeard.spriter.dom.Animation> animations
                 = entity.getAnimation();
            Com.Brashmonkey.Spriter.mergers.SpriterAnimationBuilder frameBuilder = new Com.Brashmonkey.Spriter.mergers.SpriterAnimationBuilder
                ();
            foreach (com.discobeard.spriter.dom.Animation anim in animations)
            {
                SpriterAnimation spriterAnimation = frameBuilder
                    .buildAnimation(anim);
                bool found = false;
                foreach (SpriterKeyFrame key in spriterAnimation
                    .frames)
                {
                    if (!found)
                    {
                        found = key.getTime() == anim.getLength();
                    }
                    sort(key.getObjects());
                    foreach (SpriterBone bone in key.getBones())
                    {
                        foreach (SpriterBone bone2 in key.getBones())
                        {
                            if (bone2.hasParent())
                            {
                                if (!bone2.equals(bone) && bone2.getParentId() == bone.getId())
                                {
                                    bone.addChildBone(bone2);
                                }
                            }
                        }
                        foreach (SpriterObject @object in key.getObjects(
                            ))
                        {
                            Com.Brashmonkey.Spriter.file.Reference @ref = @object.getRef();
                            com.discobeard.spriter.dom.File f = data.getFolder()[@ref.folder].getFile()[@ref.
                                file];
                            @ref.dimensions = new Com.Brashmonkey.Spriter.SpriterRectangle(0, f.getHeight(),
                                f.getWidth(), 0f);
                            if (bone.getId() == @object.getParentId())
                            {
                                bone.addChildObject(@object);
                            }
                        }
                    }
                }
                if (!found)
                {
                    SpriterKeyFrame firstFrame = spriterAnimation.frames
                        [0];
                    SpriterKeyFrame lastFrame = new SpriterKeyFrame
                        ();
                    lastFrame.setId(spriterAnimation.keyframes());
                    lastFrame.setBones(new SpriterBone[firstFrame.getBones
                        ().Length]);
                    lastFrame.setObjects(new SpriterObject[firstFrame
                        .getObjects().Length]);
                    for (int j = 0; j < lastFrame.getBones().Length; j++)
                    {
                        SpriterBone bone = new SpriterBone
                            ();
                        firstFrame.getBones()[j].copyValuesTo(bone);
                        lastFrame.getBones()[j] = bone;
                    }
                    for (int j_1 = 0; j_1 < lastFrame.getObjects().Length; j_1++)
                    {
                        SpriterObject @object = new SpriterObject
                            ();
                        firstFrame.getObjects()[j_1].copyValuesTo(@object);
                        lastFrame.getObjects()[j_1] = @object;
                    }
                    lastFrame.setTime(anim.getLength());
                    spriterAnimation.frames.Add(lastFrame);
                }
                spriterAnimations.Add(spriterAnimation);
            }
            return spriterAnimations;
        }