private TwoDirectionsMassiveBlendAnimatedBehavior(IAnimatedBehavior zero, IAnimatedBehavior one, IAnimatedBehavior minusOne, string parameterName)
 {
     Zero          = zero;
     One           = one;
     MinusOne      = minusOne;
     ParameterName = parameterName;
 }
示例#2
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();
            }
        }
示例#3
0
 public AnimToTransitionEntry(TransitionCondition transitionCondition, IAnimatedBehavior behavior)
 {
     TransitionCondition = transitionCondition;
     Behavior            = behavior;
 }
 public static IAnimatedBehavior Maybe(IAnimatedBehavior zero, IAnimatedBehavior one, IAnimatedBehavior minusOne, string parameterName)
 {
     return(zero.Equals(one) && one.Equals(minusOne) ? zero : TwoDirectionsMassiveBlendAnimatedBehavior.Of(zero, one, minusOne, parameterName));
 }
 private static TwoDirectionsMassiveBlendAnimatedBehavior Of(IAnimatedBehavior zero, IAnimatedBehavior one, IAnimatedBehavior minusOne, string parameterName)
 {
     return(new TwoDirectionsMassiveBlendAnimatedBehavior(zero, one, minusOne, parameterName));
 }
 public static IAnimatedBehavior Maybe(IAnimatedBehavior zero, IAnimatedBehavior one, string parameterName)
 {
     return(zero.Equals(one) ? zero : SimpleMassiveBlendAnimatedBehavior.Of(zero, one, parameterName));
 }
 private static SimpleMassiveBlendAnimatedBehavior Of(IAnimatedBehavior zero, IAnimatedBehavior one, string parameterName)
 {
     return(new SimpleMassiveBlendAnimatedBehavior(zero, one, parameterName));
 }
 private SimpleMassiveBlendAnimatedBehavior(IAnimatedBehavior zero, IAnimatedBehavior one, string parameterName)
 {
     Zero          = zero;
     One           = one;
     ParameterName = parameterName;
 }
示例#9
0
        private void ForTwoDirectionsMassiveBlend(List <TransitionCondition> transitionConditions, IAnimatedBehavior zero, IAnimatedBehavior one, IAnimatedBehavior minusOne, string parameterName)
        {
            var zeroMotion     = Derive(zero);
            var oneMotion      = Derive(one);
            var minusOneMotion = Derive(minusOne);
            var state          = CreateTwoDirectionsMassiveBlendState(zeroMotion, oneMotion, minusOneMotion, parameterName, ToPotentialGridPosition(transitionConditions[0]));

            foreach (var transitionCondition in transitionConditions)
            {
                CreateTransition(GetNullableStageValue(transitionCondition),
                                 transitionCondition.Permutation,
                                 state, transitionCondition.TransitionDuration);
            }
        }