Exemplo n.º 1
0
        private static IAnimatedBehavior OfSimple(MassiveBlendManifest manifest, Permutation currentPermutation)
        {
            var zero = manifest.EquatedManifests[0].Poses[currentPermutation];
            var one  = manifest.EquatedManifests[1].Poses[currentPermutation];

            return(SimpleMassiveBlendAnimatedBehavior.Maybe(zero, one, manifest.SimpleParameterName));
        }
Exemplo n.º 2
0
        private static Dictionary <IAnimatedBehavior, List <TransitionCondition> > DecomposeMassiveIntoBehaviors(List <ManifestBinding> activityManifests)
        {
            Dictionary <IAnimatedBehavior, List <TransitionCondition> > representation = activityManifests
                                                                                         .Where(binding => binding.Manifest.Kind() == ManifestKind.Massive)
                                                                                         .SelectMany(binding =>
            {
                MassiveBlendManifest manifest = (MassiveBlendManifest)binding.Manifest;

                return(Permutation.All().Select(currentPermutation =>
                {
                    var animatedBehavior = MassiveBlendToAnimatedBehavior(manifest, currentPermutation);
                    return new KeyValuePair <IAnimatedBehavior, TransitionCondition.ActivityBoundTransitionCondition>(
                        animatedBehavior,
                        new TransitionCondition.ActivityBoundTransitionCondition(
                            binding.StageValue,
                            manifest.TransitionDuration(),
                            currentPermutation,
                            binding.LayerOrdinal
                            )
                        );
                }).ToList());
            })
                                                                                         .GroupBy(pair => pair.Key, pair => pair.Value)
                                                                                         .ToDictionary(x => (IAnimatedBehavior)x.Key, x => x.Cast <TransitionCondition>().ToList());

            return(representation);
        }
Exemplo n.º 3
0
 private static IManifest OfComplexBlendTreeBased(ComboGestureMassiveBlend massiveBlend, AnimationClip fallbackWhenAnyClipIsNull)
 {
     return(MassiveBlendManifest.OfComplex(
                massiveBlend.mode,
                massiveBlend.blendTreeMoods
                .Select(mood => SharedLayerUtils.FromMoodSet(mood, fallbackWhenAnyClipIsNull))
                .ToList(),
                (BlendTree)massiveBlend.blendTree,
                massiveBlend.transitionDuration
                ));
 }
Exemplo n.º 4
0
 private static IManifest OfSimple(ComboGestureMassiveBlend massiveBlend, AnimationClip fallbackWhenAnyClipIsNull)
 {
     return(MassiveBlendManifest.OfParameterBased(
                massiveBlend.mode,
                new List <IManifest>
     {
         SharedLayerUtils.FromMoodSet(massiveBlend.simpleZero, fallbackWhenAnyClipIsNull),
         SharedLayerUtils.FromMoodSet(massiveBlend.simpleOne, fallbackWhenAnyClipIsNull),
     },
                massiveBlend.simpleParameterName,
                massiveBlend.transitionDuration
                ));
 }
Exemplo n.º 5
0
        private static IAnimatedBehavior MassiveBlendToAnimatedBehavior(MassiveBlendManifest manifest, Permutation currentPermutation)
        {
            switch (manifest.Mode)
            {
            case CgeMassiveBlendMode.Simple:
                return(OfSimple(manifest, currentPermutation));

            case CgeMassiveBlendMode.TwoDirections:
                return(OfTwoDirections(manifest, currentPermutation));

            case CgeMassiveBlendMode.ComplexBlendTree:
                return(OfComplexBlendTree(manifest, currentPermutation));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 6
0
        private static IAnimatedBehavior OfComplexBlendTree(MassiveBlendManifest manifest, Permutation currentPermutation)
        {
            var poses = manifest.EquatedManifests.Select(permutationManifest => permutationManifest.Poses[currentPermutation]).ToList();

            return(ComplexMassiveBlendAnimatedBehavior.Of(poses, manifest.BlendTree));
        }