private void FinalizeLoopEnd()
        {
            waitingForReturnToLocomotion = false;
            PlayingAnimation             = false;

            UnapplyAnimationConfiguration(currentLoopingAnimation);

            currentLoopingAnimation = null;
        }
 public void StartLoopingAnimation(AnimationClip animation, AnimationClip enterAnimation = null, AnimationClip exitAnimation = null,
                                   bool applyRootMotion = false,
                                   bool makeIntangible  = false,
                                   bool makeKinematic   = false,
                                   bool overrideLegs    = true
                                   )
 {
     currentLoopingAnimation = new MeatPuppetLoopingAnimationConfiguration()
     {
         loopingClip     = animation,
         entryClip       = enterAnimation,
         exitClip        = exitAnimation,
         applyRootMotion = applyRootMotion,
         makeIntangible  = makeIntangible,
         makeKinematic   = makeKinematic,
         overrideLegs    = overrideLegs
     };
     StartLoopingAnimation(currentLoopingAnimation);
 }
        public void StartLoopingAnimation(MeatPuppetLoopingAnimationConfiguration animation)
        {
            // TODO: add callback for when entry animation ends and looping animation starts
            // TODO: wait for the last looping or one-shot animation to finish
            currentLoopingAnimation = animation;

            parentPuppet.AnimatorHook.AnimatorController[LoopAnimationKey]      = animation.loopingClip;
            parentPuppet.AnimatorHook.AnimatorController[LoopEnterAnimationKey] = animation.entryClip;
            parentPuppet.AnimatorHook.AnimatorController[LoopExitAnimationKey]  = animation.exitClip;

            parentPuppet.AnimatorHook.Animator.SetBool("Loop Masked", !animation.overrideLegs);
            parentPuppet.AnimatorHook.Animator.SetTrigger(LoopStartTrigger);
            parentPuppet.AnimatorHook.Animator.ResetTrigger(LoopStopTrigger);
            parentPuppet.AnimatorHook.Animator.SetBool(LoopEnterBool, animation.entryClip != null);
            parentPuppet.AnimatorHook.Animator.SetBool(LoopExitBool, animation.exitClip != null);

            PlayingAnimation             = true;
            waitingForReturnToLocomotion = true;

            ApplyAnimationConfiguration(animation);
        }