Playable CompileTrackPlayable(PlayableGraph graph, TrackAsset track, GameObject go, IntervalTree <RuntimeElement> tree, AppliedOffsetMode mode) { var mixer = AnimationMixerPlayable.Create(graph, track.clips.Length); for (int i = 0; i < track.clips.Length; i++) { var c = track.clips[i]; var asset = c.asset as PlayableAsset; if (asset == null) { continue; } var animationAsset = asset as AnimationPlayableAsset; if (animationAsset != null) { animationAsset.appliedOffsetMode = mode; } var source = asset.CreatePlayable(graph, go); if (source.IsValid()) { var clip = new RuntimeClip(c, source, mixer); tree.Add(clip); graph.Connect(source, 0, mixer, i); mixer.SetInputWeight(i, 0.0f); } } return(ApplyTrackOffset(graph, mixer, go, mode)); }
internal virtual Playable OnCreateClipPlayableGraph(PlayableGraph graph, GameObject go, IntervalTree <RuntimeElement> tree) { if (tree == null) { throw new ArgumentException("IntervalTree argument cannot be null", "tree"); } if (go == null) { throw new ArgumentException("GameObject argument cannot be null", "go"); } var blend = CreateTrackMixer(graph, go, clips.Length); for (var c = 0; c < clips.Length; c++) { var source = CreatePlayable(graph, go, clips[c]); if (source.IsValid()) { source.SetDuration(clips[c].duration); var clip = new RuntimeClip(clips[c], source, blend); tree.Add(clip); graph.Connect(source, 0, blend, c); blend.SetInputWeight(c, 0.0f); } } return(blend); }
internal virtual Playable OnCreatePlayableGraph(PlayableGraph graph, GameObject go, IntervalTree <RuntimeElement> tree) { if (tree == null) { throw new ArgumentException("IntervalTree argument cannot be null", "tree"); } if (go == null) { throw new ArgumentException("GameObject argument cannot be null", "go"); } Playable playable = this.CreateTrackMixer(graph, go, this.clips.Length); for (int i = 0; i < this.clips.Length; i++) { Playable playable2 = this.CreatePlayable(graph, go, this.clips[i]); if (playable2.IsValid <Playable>()) { playable2.SetDuration(this.clips[i].duration); RuntimeClip item = new RuntimeClip(this.clips[i], playable2, playable); tree.Add(item); graph.Connect <Playable, Playable>(playable2, 0, playable, i); playable.SetInputWeight(i, 0f); } } return(playable); }
internal Playable CompileTrackPlayable(PlayableGraph graph, TrackAsset track, GameObject go, IntervalTree <RuntimeElement> tree) { AnimationMixerPlayable animationMixerPlayable = AnimationMixerPlayable.Create(graph, track.clips.Length, false); for (int i = 0; i < track.clips.Length; i++) { TimelineClip timelineClip = track.clips[i]; PlayableAsset playableAsset = timelineClip.asset as PlayableAsset; if (!(playableAsset == null)) { if (timelineClip.recordable) { AnimationPlayableAsset animationPlayableAsset = playableAsset as AnimationPlayableAsset; if (animationPlayableAsset != null) { animationPlayableAsset.removeStartOffset = !timelineClip.recordable; } } Playable playable = playableAsset.CreatePlayable(graph, go); if (playable.IsValid <Playable>()) { RuntimeClip item = new RuntimeClip(timelineClip, playable, animationMixerPlayable); tree.Add(item); graph.Connect <Playable, AnimationMixerPlayable>(playable, 0, animationMixerPlayable, i); animationMixerPlayable.SetInputWeight(i, 0f); } } } return(this.ApplyTrackOffset(graph, animationMixerPlayable)); }
internal virtual Playable CompileClips(PlayableGraph graph, GameObject go, IList<TimelineClip> timelineClips, IntervalTree<RuntimeElement> tree) { var blend = CreateTrackMixer(graph, go, timelineClips.Count); for (var c = 0; c < timelineClips.Count; c++) { var source = CreatePlayable(graph, go, timelineClips[c]); if (source.IsValid()) { source.SetDuration(timelineClips[c].duration); var clip = new RuntimeClip(timelineClips[c], source, blend); tree.Add(clip); graph.Connect(source, 0, blend, c); blend.SetInputWeight(c, 0.0f); } } ConfigureTrackAnimation(tree, go, blend); return blend; }