private void PlayBlendedAnimation(int layerID, BlendedAnimationInput BlendedAnimationInput, Func <float> InputWeightProvider) { if (this.AllAnimationLayersCurrentlyPlaying.ContainsKey(layerID)) { this.DestroyLayer(layerID); } BlendedAnimationLayer BlendedAnimationLayer = new BlendedAnimationLayer(this.GlobalPlayableGraph, this.AnimationLayerMixerPlayable, layerID, BlendedAnimationInput, InputWeightProvider); this.AllAnimationLayersCurrentlyPlaying[layerID] = BlendedAnimationLayer; this.OrderedByInputHandlerAnimationLayers.Add(BlendedAnimationLayer); this.SortLayers(); PlayableExtensions.SetInputWeight(this.AnimationLayerMixerPlayable, this.AllAnimationLayersCurrentlyPlaying[layerID].Inputhandler, 1f); }
private void PlayBlendedAnimation(int layerID, BlendedAnimationInput BlendedAnimationInput, Func <float> InputWeightProvider) { if (this.AllAnimationLayersCurrentlyPlaying.ContainsKey(layerID)) { this.DestroyLayer(layerID); } BlendedAnimationLayer BlendedAnimationLayer = new BlendedAnimationLayer(this.GlobalPlayableGraph, this.AnimationLayerMixerPlayable, layerID, BlendedAnimationInput.BlendedAnimationClips.ConvertAll(i => i.ToBlendedAnimationClip()), BlendedAnimationInput.BlendedAnimationSpeedCurve); BlendedAnimationLayer.Inputhandler = PlayableExtensions.AddInput(this.AnimationLayerMixerPlayable, BlendedAnimationLayer.AnimationMixerPlayable, 0); this.AllAnimationLayersCurrentlyPlaying[layerID] = BlendedAnimationLayer; this.OrderedByInputHandlerAnimationLayers.Add(BlendedAnimationLayer); this.SortLayers(); PlayableExtensions.SetInputWeight(this.AnimationLayerMixerPlayable, this.AllAnimationLayersCurrentlyPlaying[layerID].Inputhandler, 1f); if (InputWeightProvider != null) { BlendedAnimationLayer.RegisterInputWeightProvider(InputWeightProvider); } }