public FGAnimationKeyFrame LoopAnimationPlay(FGAnimation animation, double dt)
    {
        bool reset = animatorTimer >= animation.duration;

        if (reset)
        {
            animatorTimer -= animation.duration;
        }

        float adjustedTime = (float)animatorTimer;

        if (animation.type == FGAnimationType.REVERSE)
        {
            adjustedTime = animation.duration - adjustedTime;
        }

        currentFrame = AnimationPlayer.GetCurrentFrame(animation, adjustedTime);
        FGAnimationKeyFrame keyFrame = animation.GetKeyFrame(currentFrame);

        animatorTimer += dt;

        if (keyFrame != null)
        {
            ApplyFrame(keyFrame);
        }


        if (_currentKeyFrame != null)
        {
            return(_currentKeyFrame);
        }
        return(animation.frames[0]);
    }
    public void LastFrame(FGAnimation animation)
    {
        if ((currentFrame - 1) < 0)
        {
            currentFrame = animation.totalFrameCount - 1;
        }
        else
        {
            currentFrame--;
        }
        FGAnimationKeyFrame keyFrame = animation.GetKeyFrame(currentFrame);

        ApplyFrame(keyFrame);
    }
    public void NextFrame(FGAnimation animation)
    {
        if (animation.totalFrameCount == (currentFrame + 1))
        {
            currentFrame = 0;
        }
        else
        {
            currentFrame++;
        }
        FGAnimationKeyFrame keyFrame = animation.GetKeyFrame(currentFrame);

        ApplyFrame(keyFrame);
    }