Esempio n. 1
0
        private static void AddClipsAsBlendTree(AnimationPlayer animationPlayer, PersistedInt selectedLayer, PersistedInt selectedState,
                                                AnimationPlayerEditor editor, List <AnimationClip> animationClips)
        {
            EditorUtilities.RecordUndo(animationPlayer, "Added clip to Animation Player");
            var layer          = animationPlayer.layers[selectedLayer];
            int numClipsBefore = layer.states.Count;

            var newStateName = GetUniqueStateName(BlendTree1D.DefaultName, layer.states);
            var newState     = BlendTree1D.Create(newStateName);

            foreach (var clip in animationClips)
            {
                var newEntry = new BlendTreeEntry1D
                {
                    clip = clip
                };
                newState.blendTree.Add(newEntry);
            }

            layer.states.Add(newState);

            selectedState.SetTo(numClipsBefore);

            editor.MarkDirty();
        }
Esempio n. 2
0
 private static void DrawThresholdFor1DBlendTree(string blendVarName, BlendTreeEntry1D entry)
 {
     entry.threshold = EditorUtilities.FloatField($"When '{blendVarName}' =", entry.threshold, 150f, 200f);
 }