internal override Playable OnCreatePlayableGraph(PlayableGraph graph, GameObject go, IntervalTree <RuntimeElement> tree)
        {
            AudioMixerPlayable audioMixerPlayable = AudioMixerPlayable.Create(graph, base.clips.Length, false);

            for (int i = 0; i < base.clips.Length; i++)
            {
                TimelineClip  timelineClip  = base.clips[i];
                PlayableAsset playableAsset = timelineClip.asset as PlayableAsset;
                if (!(playableAsset == null))
                {
                    float num = 0.1f;
                    AudioPlayableAsset audioPlayableAsset = timelineClip.asset as AudioPlayableAsset;
                    if (audioPlayableAsset != null)
                    {
                        num = audioPlayableAsset.bufferingTime;
                    }
                    Playable playable = playableAsset.CreatePlayable(graph, go);
                    if (playable.IsValid <Playable>())
                    {
                        tree.Add(new ScheduleRuntimeClip(timelineClip, playable, audioMixerPlayable, (double)num, 0.1));
                        graph.Connect <Playable, AudioMixerPlayable>(playable, 0, audioMixerPlayable, i);
                        playable.SetSpeed(timelineClip.timeScale);
                        playable.SetDuration(timelineClip.extrapolatedDuration);
                        audioMixerPlayable.SetInputWeight(playable, 1f);
                    }
                }
            }
            return(audioMixerPlayable);
        }
        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));
        }
Beispiel #3
0
        /************************************************************************************************************************/

        private void CreatePlayable(PlayableAsset asset)
        {
            if (asset == null)
            {
                throw new ArgumentNullException("asset");
            }

            _Asset    = asset;
            _Playable = asset.CreatePlayable(Root._Graph, Root.Component.gameObject);
        }
Beispiel #4
0
    public static int CreatePlayable(IntPtr l)
    {
        int result;

        try
        {
            PlayableAsset playableAsset = (PlayableAsset)LuaObject.checkSelf(l);
            PlayableGraph graph;
            LuaObject.checkValueType <PlayableGraph>(l, 2, out graph);
            GameObject owner;
            LuaObject.checkType <GameObject>(l, 3, out owner);
            Playable playable = playableAsset.CreatePlayable(graph, owner);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, playable);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }