private void NextKeyframe()
        {
            //Moves to the next keyframe, stopping the animation if we've reached the last one.

            //Stop the animation if there are no more keyframes
            nextFrameIndex++;
            if (nextFrameIndex >= currentAnimation.numKeyframes)
            {
                //Set the transform to the end of the animation
                nextFrame.transformation.ApplyLocal(transform);

                //Stop the animation
                isPlaying = false;

                frameTimer       = 0;
                globalTimer      = 0;
                currentAnimation = null;

                return;
            }

            //Move to the next set of keyframes
            frameTimer -= nextFrame.timeOffset;

            prevFrame = nextFrame;
            nextFrame = currentAnimation.GetKeyframe(nextFrameIndex);
        }
        //Interface

        public void PlayAnimation(SimpleAnimation animation)
        {
            //Start playing the given animation from the beginning
            currentAnimation = animation;
            isPlaying        = true;

            //Get the prev/next frames
            //TODO: Handle edge cases with <= 1 keyframe in the animation
            nextFrameIndex = 1;
            nextFrame      = animation.GetKeyframe(nextFrameIndex);
            prevFrame      = animation.GetKeyframe(0);

            //Reset timers
            frameTimer  = 0;
            globalTimer = 0;

            //Apply the first frame
            UpdateTransform();
        }