Example #1
0
        private Motion Derive(IAnimatedBehavior behavior)
        {
            switch (behavior.Nature())
            {
            case AnimatedBehaviorNature.Single:
                return(((SingleAnimatedBehavior)behavior).Posing.Clip);

            case AnimatedBehaviorNature.Analog:
                AnalogAnimatedBehavior aab = (AnalogAnimatedBehavior)behavior;
                return(CreateBlendTree(
                           aab.Resting.Clip,
                           aab.Squeezing.Clip,
                           aab.HandSide == HandSide.LeftHand
                            ? LeftParam(_useGestureWeightCorrection, _useSmoothing)
                            : RightParam(_useGestureWeightCorrection, _useSmoothing),
                           SanitizeName(UnshimName(aab.Resting.Clip.name) + " MB " + UnshimName((aab.Squeezing.Clip.name))),
                           _animatorController));

            case AnimatedBehaviorNature.PuppetToAnalog:
                PuppetToAnalogAnimatedBehavior pta = (PuppetToAnalogAnimatedBehavior)behavior;
                return(CreateBlendTree(
                           pta.Resting,
                           pta.Squeezing.Clip,
                           pta.HandSide == HandSide.LeftHand
                            ? LeftParam(_useGestureWeightCorrection, _useSmoothing)
                            : RightParam(_useGestureWeightCorrection, _useSmoothing),
                           SanitizeName(UnshimName(pta.Resting.name) + " MB " + UnshimName((pta.Squeezing.Clip.name))),
                           _animatorController));

            case AnimatedBehaviorNature.DualAnalog:
                DualAnalogAnimatedBehavior da = (DualAnalogAnimatedBehavior)behavior;
                return(CreateDualBlendTree(da.Resting.Clip, da.BothSqueezing.Clip, da.LeftSqueezing.Clip, da.LeftSqueezing.Clip, SanitizeName(UnshimName(da.BothSqueezing.Clip.name)), _animatorController, _useGestureWeightCorrection, _useSmoothing));

            case AnimatedBehaviorNature.PuppetToDualAnalog:
                PuppetToDualAnalogAnimatedBehavior ptda = (PuppetToDualAnalogAnimatedBehavior)behavior;
                return(CreateDualBlendTree(ptda.Resting, ptda.BothSqueezing.Clip, ptda.LeftSqueezing.Clip, ptda.LeftSqueezing.Clip, SanitizeName(UnshimName(ptda.BothSqueezing.Clip.name)), _animatorController, _useGestureWeightCorrection, _useSmoothing));

            case AnimatedBehaviorNature.Puppet:
                return(((PuppetAnimatedBehavior)behavior).Tree);

            case AnimatedBehaviorNature.SimpleMassiveBlend:
            case AnimatedBehaviorNature.TwoDirectionsMassiveBlend:
            case AnimatedBehaviorNature.ComplexMassiveBlend:
                throw new ArgumentOutOfRangeException();

            default:
                throw new ArgumentOutOfRangeException();
            }
        }