Beispiel #1
0
        internal Playable CreatePlayableGraph(PlayableGraph graph, GameObject go, IntervalTree <RuntimeElement> tree, Playable timelinePlayable)
        {
            var mixerPlayable = Playable.Null;

            if (CanCompileClipsRecursive())
            {
                UpdateDuration();
                mixerPlayable = OnCreateClipPlayableGraph(graph, go, tree);
            }

            var notificationsPlayable = CreateNotificationsPlayable(graph, mixerPlayable, go, timelinePlayable);

            if (!notificationsPlayable.IsValid() && !mixerPlayable.IsValid())
            {
                Debug.LogErrorFormat("Track {0} of type {1} has no notifications and returns an invalid mixer Playable", name,
                                     GetType().FullName);

                return(Playable.Create(graph));
            }

            var playableGraph = CanCompileNotifications() ? notificationsPlayable : mixerPlayable;

            ConfigureTrackAnimation(tree, go, playableGraph);

            return(playableGraph);
        }
Beispiel #2
0
        // Creates the playable that represents the instance that plays this clip.
        // Here a hidden VideoPlayer is being created for the PlayableBehaviour to use
        // to control playback. The PlayableBehaviour is responsible for deleting the player.
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            Camera camera = targetCamera.Resolve(graph.GetResolver());

            if (camera == null)
            {
                camera = Camera.main;
            }

            // If we are unable to create a player, return a playable with no behaviour attached.
            VideoPlayer player = CreateVideoPlayer(camera, audioSource.Resolve(graph.GetResolver()));

            if (player == null)
            {
                return(Playable.Create(graph));
            }

            ScriptPlayable <VideoPlayableBehaviour> playable =
                ScriptPlayable <VideoPlayableBehaviour> .Create(graph);

            VideoPlayableBehaviour playableBehaviour = playable.GetBehaviour();

            playableBehaviour.videoPlayer = player;
            playableBehaviour.preloadTime = preloadTime;
            playableBehaviour.clipInTime  = clipInTime;
            playableBehaviour.startTime   = startTime;

            return(playable);
        }
Beispiel #3
0
        internal Playable CreatePlayableGraph(PlayableGraph graph, GameObject go, IntervalTree <RuntimeElement> tree, Playable timelinePlayable)
        {
            UpdateDuration();
            var mixerPlayable = Playable.Null;

            if (CanCompileClipsRecursive())
            {
                mixerPlayable = OnCreateClipPlayableGraph(graph, go, tree);
            }

            var notificationsPlayable = CreateNotificationsPlayable(graph, mixerPlayable, go, timelinePlayable);

            // clear the temporary build data to avoid holding references
            // case 1253974
            s_BuildData.Clear();
            if (!notificationsPlayable.IsValid() && !mixerPlayable.IsValid())
            {
                Debug.LogErrorFormat("Track {0} of type {1} has no notifications and returns an invalid mixer Playable", name,
                                     GetType().FullName);

                return(Playable.Create(graph));
            }

            return(notificationsPlayable.IsValid() ? notificationsPlayable : mixerPlayable);
        }
Beispiel #4
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            List <Playable> list       = new List <Playable>();
            GameObject      gameObject = this.sourceGameObject.Resolve(graph.GetResolver());

            if (this.prefabGameObject != null)
            {
                Transform parentTransform = (!(gameObject != null)) ? null : gameObject.transform;
                ScriptPlayable <PrefabControlPlayable> playable = PrefabControlPlayable.Create(graph, this.prefabGameObject, parentTransform);
                gameObject = playable.GetBehaviour().prefabInstance;
                list.Add(playable);
            }
            this.m_Duration    = PlayableBinding.DefaultDuration;
            this.m_SupportLoop = false;
            Playable result;

            if (gameObject == null)
            {
                result = Playable.Create(graph, 0);
            }
            else
            {
                IList <PlayableDirector> component  = this.GetComponent <PlayableDirector>(gameObject);
                IList <ParticleSystem>   component2 = this.GetComponent <ParticleSystem>(gameObject);
                this.UpdateDurationAndLoopFlag(component, component2);
                PlayableDirector component3 = go.GetComponent <PlayableDirector>();
                if (component3 != null)
                {
                    this.m_ControlDirectorAsset = component3.playableAsset;
                }
                if (go == gameObject && this.prefabGameObject == null)
                {
                    Debug.LogWarning("Control Playable (" + base.name + ") is referencing the same PlayableDirector component than the one in which it is playing.");
                    this.active = false;
                    if (!this.searchHierarchy)
                    {
                        this.updateDirector = false;
                    }
                }
                if (this.active)
                {
                    this.CreateActivationPlayable(gameObject, graph, list);
                }
                if (this.updateDirector)
                {
                    this.SearchHierarchyAndConnectDirector(component, graph, list);
                }
                if (this.updateParticle)
                {
                    this.SearchHiearchyAndConnectParticleSystem(component2, graph, list);
                }
                if (this.updateITimeControl)
                {
                    ControlPlayableAsset.SearchHierarchyAndConnectControlableScripts(ControlPlayableAsset.GetControlableScripts(gameObject), graph, list);
                }
                Playable playable2 = ControlPlayableAsset.ConnectPlayablesToMixer(graph, list);
                result = playable2;
            }
            return(result);
        }
Beispiel #5
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            Playable root = Playable.Null;

            if (!root.IsValid())
            {
                root = Playable.Create(graph);
            }
            return(root);
        }
        private void SetupTest(float[] inputWeights)
        {
            graph = PlayableGraph.Create();

            playable = Playable.Create(graph, inputWeights.Length);
            for (int i = 0; i < inputWeights.Length; i++)
            {
                playable.SetInputWeight(i, inputWeights[i]);
            }
        }
Beispiel #7
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            List <Playable> playableList = new List <Playable>();
            GameObject      gameObject   = GetGameObjectBinding(go.GetComponent <PlayableDirector>());

            if (this.prefabGameObject != null)
            {
                Transform parentTransform = !(gameObject != null) ? (Transform)null : gameObject.transform;
                ScriptPlayable <PrefabControlPlayable> scriptPlayable = PrefabControlPlayable.Create(graph, this.prefabGameObject, parentTransform);
                gameObject = scriptPlayable.GetBehaviour().prefabInstance;
                playableList.Add((Playable)scriptPlayable);
            }

            this.UpdateDurationAndLoopFlag(gameObject);
            if (gameObject == null)
            {
                return(Playable.Create(graph, 0));
            }

            PlayableDirector component = go.GetComponent <PlayableDirector>();

            if (component != null)
            {
                this.m_ControlDirectorAsset = component.playableAsset;
            }

            if (go == gameObject && this.prefabGameObject == null)
            {
                UnityEngine.Debug.LogWarning((object)("Control Playable (" + this.name + ") is referencing the same PlayableDirector component than the one in which it is playing."));
                this.active = false;
                if (!this.searchHierarchy)
                {
                    this.updateDirector = false;
                }
            }

            if (this.active)
            {
                this.CreateActivationPlayable(gameObject, graph, playableList);
            }
            if (this.updateDirector)
            {
                this.SearchHierarchyAndConnectDirector(gameObject, graph, playableList);
            }
            if (this.updateParticle)
            {
                this.SearchHiearchyAndConnectParticleSystem(gameObject, graph, playableList);
            }
            if (this.updateITimeControl)
            {
                this.SearchHierarchyAndConnectControlableScripts(gameObject, graph, playableList);
            }

            return(this.ConnectPlayablesToMixer(graph, playableList));
        }
Beispiel #8
0
        // Token: 0x060001A4 RID: 420 RVA: 0x000088C4 File Offset: 0x00006AC4
        protected static Playable ConnectPlayablesToMixer(PlayableGraph graph, List <Playable> playables)
        {
            Playable playable = Playable.Create(graph, playables.Count);

            for (int num = 0; num != playables.Count; num++)
            {
                ConnectMixerAndPlayable(graph, playable, playables[num], num);
            }
            playable.SetPropagateSetTime(true);
            return(playable);
        }
        private static Playable ConnectPlayablesToMixer(PlayableGraph graph, List <Playable> playables)
        {
            Playable val = Playable.Create(graph, playables.Count);

            for (int i = 0; i != playables.Count; i++)
            {
                ConnectMixerAndPlayable(graph, val, playables[i], i);
            }
            PlayableExtensions.SetPropagateSetTime <Playable>(val, true);
            return(val);
        }
        private static Playable ConnectPlayablesToMixer(PlayableGraph graph, List <Playable> playables)
        {
            Playable playable = Playable.Create(graph, playables.Count);

            for (int num = 0; num != playables.Count; num++)
            {
                ControlPlayableAsset.ConnectMixerAndPlayable(graph, playable, playables[num], num);
            }
            PlayableExtensions.SetPropagateSetTime <Playable>(playable, true);
            return(playable);
        }
Beispiel #11
0
 // Factory method that generates a playable based on this asset
 public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
 {
     if (!Disable)
     {
         return(ScriptPlayable <HeroPerformHit> .Create(graph));
     }
     else
     {
         return(Playable.Create(graph));
     }
 }
Beispiel #12
0
        private Playable ConnectPlayablesToMixer(PlayableGraph graph, List <Playable> playables)
        {
            Playable playable = Playable.Create(graph, playables.Count);

            for (int portIndex = 0; portIndex != playables.Count; ++portIndex)
            {
                this.ConnectMixerAndPlayable(graph, playable, playables[portIndex], portIndex);
            }
            playable.SetPropagateSetTime <Playable>(true);
            return(playable);
        }
        static Playable ConnectPlayablesToMixer(PlayableGraph graph, List <Playable> playables)
        {
            var mixer = Playable.Create(graph, playables.Count);

            for (int i = 0; i != playables.Count; ++i)
            {
                ConnectMixerAndPlayable(graph, mixer, playables[i], i);
            }

            mixer.SetPropagateSetTime(true);

            return(mixer);
        }
Beispiel #14
0
        public PlayableStateController.StateInfo AddBlendTree(PlayableStateController.BlendTreeConfig[] configs, string paramName, string stateName = null, string groupName = null, int layer = 0)
        {
            if (configs == null)
            {
                return(null);
            }
            for (int i = 0; i < configs.Length; i++)
            {
                AnimationClipPlayable clipPlayable = AnimationClipPlayable.Create(m_Graph, configs[i].clip);
                configs[i].playable = clipPlayable;
            }
            Playable playable = Playable.Create(m_Graph, 1);

            return(m_StateController.AddBlendTree(stateName, playable, configs, paramName, groupName, layer));
        }
Beispiel #15
0
        // Factory method that generates a playable based on this asset
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            var playable = ScriptPlayable <GameEventTriggerBehaviour> .Create(graph, template);

            var clone = playable.GetBehaviour();

            if (clone != null)
            {
                clone.type      = type;
                clone.gameEvent = gameEvent;
                clone.eventID   = eventID;
                clone.data      = data;
            }

            return(Playable.Create(graph));
        }
    // Start is called before the first frame update
    void Start()
    {
        PlayableGraph playableGraph = PlayableGraph.Create();

        playableGraph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);

        var playable = Playable.Create(playableGraph);

        Debug.Log(playable.IsValid());

        //clipState = new APClipState(EAPStateID.None);
        //clipState.OnCreate(playableGraph, new ClipHandle(clip));
        //clipState.OnEnter();

        //Playable output = clipState.Output;

        //AnimationPlayableOutput playableOutput = AnimationPlayableOutput.Create(playableGraph, "out", GetComponent<Animator>());
        //playableOutput.SetSourcePlayable(output);

        playableGraph.Play();
    }
    // Start is called before the first frame update
    void Start()
    {
        PlayableGraph          graph = PlayableGraph.Create();
        AnimationClipPlayable  clip1 = AnimationClipPlayable.Create(graph, clip01);
        AnimationClipPlayable  clip2 = AnimationClipPlayable.Create(graph, clip02);
        AnimationMixerPlayable mixer = AnimationMixerPlayable.Create(graph, 2, true);

        mixer.SetInputWeight(4, 0.5f);
        mixer.SetInputWeight(9, 0.5f);

        AnimationPlayableOutput output = AnimationPlayableOutput.Create(graph, "out", GetComponent <Animator>());

        graph.Connect(clip1, 0, mixer, 4);
        graph.Connect(clip2, 0, mixer, 9);
        Playable playable = Playable.Create(graph, 1);

        graph.Connect(mixer, 0, playable, 0);
        output.SetSourcePlayable(playable);

        graph.Play();
    }
Beispiel #18
0
    public static int Create_s(IntPtr l)
    {
        int result;

        try
        {
            PlayableGraph graph;
            LuaObject.checkValueType <PlayableGraph>(l, 1, out graph);
            int inputCount;
            LuaObject.checkType(l, 2, out inputCount);
            Playable playable = Playable.Create(graph, inputCount);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, playable);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Beispiel #19
0
            public CollectionNode(PlayableGraph graph, GameObject owner)
            {
                playableGraph = graph;
                ownerObject   = owner;
                childNodes    = new List <T>();

                passtroughPlayable = Playable.Create(graph, mixerOutputTypes.Length);
                passtroughPlayable.SetOutputCount(mixerOutputTypes.Length);
                passtroughPlayable.SetTraversalMode(PlayableTraversalMode.Passthrough);

                animationPlayable = CreateAnimationPlayable(graph, owner);
                passtroughPlayable.ConnectInput(0, animationPlayable, 0, 1f);

                ikPlayable = CreateIKPlayable(graph, owner);
                passtroughPlayable.ConnectInput(1, ikPlayable, 0, 1f);

                playables = new[]
                {
                    animationPlayable,
                    ikPlayable
                };
            }
    public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
    {
        T resolvedInvokeTarget = invokeTarget.Resolve(graph.GetResolver());

        if (resolvedInvokeTarget != null)
        {
            InvokerPlayableBehaviour invoker = new InvokerPlayableBehaviour();
            Action action;
            if (MethodPairings(resolvedInvokeTarget).TryGetValue(selectedMethod, out action))
            {
                invoker.InvokeOnPlay = action;
                invoker.EnumName     = selectedMethod.ToString();
                //Debug.Log("Creating Playable " + selectedMethod.ToString());
                return(ScriptPlayable <InvokerPlayableBehaviour> .Create(graph, invoker));
            }
            else
            {
                Debug.LogError($"The enum {selectedMethod} is not paired with any delegate.");
            }
        }
        //Debug.LogWarning("Cannot resolve the exposed reference.");
        return(Playable.Create(graph));
    }
Beispiel #21
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            if (string.IsNullOrEmpty(eventName))
            {
                return(Playable.Create(graph));
            }

            var eventTable = go.GetComponent <EventTable>();

            if (eventTable == null)
            {
                return(Playable.Create(graph));
            }

            var unityEvent = eventTable.GetEvent(eventName, false);

            if (unityEvent == null)
            {
                return(Playable.Create(graph));
            }

            return(UnityEventPlayable.Create(graph, unityEvent));
        }
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            Playable val = Playable.Null;

            List <Playable> list = new List <Playable>();
            GameObject      val2 = GetGameObjectBinding(go.GetComponent <PlayableDirector>());


            m_Duration    = PlayableBinding.DefaultDuration;
            m_SupportLoop = false;
            if (val2 != null)
            {
                IList <PlayableDirector> directors = (!updateDirector) ? k_EmptyDirectorsList : GetComponent <PlayableDirector>(val2);
                UpdateDurationAndLoopFlag(directors);
                PlayableDirector component = go.GetComponent <PlayableDirector>();
                if (component != null)
                {
                    m_ControlDirectorAsset = component.playableAsset;
                }

                if (active)
                {
                    CreateActivationPlayable(val2, graph, list);
                }
                if (updateDirector)
                {
                    SearchHierarchyAndConnectDirector(directors, graph, list, false);
                }

                val = ConnectPlayablesToMixer(graph, list);
            }
            if (!PlayableExtensions.IsValid <Playable>(val))
            {
                val = Playable.Create(graph, 0);
            }
            return(val);
        }
    // Use this for initialization
    void Start()
    {
        playableGraph = PlayableGraph.Create("My Graph");
        playableGraph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
        var playableOutput = AnimationPlayableOutput.Create(playableGraph, "animation output", GetComponent <Animator>());


        clipPlayable  = AnimationClipPlayable.Create(playableGraph, clip);
        clipPlayable2 = AnimationClipPlayable.Create(playableGraph, clip2);
        mixer         = AnimationMixerPlayable.Create(playableGraph, 2);

        playableOutput.SetSourcePlayable(mixer, 0);
        playableGraph.Connect(clipPlayable2, 0, mixer, 0);
        playableGraph.Connect(clipPlayable, 0, mixer, 1);

        //mixer.AddInput(clipPlayable, 0);
        //mixer.AddInput(clipPlayable2, 0);

        var p = Playable.Create(playableGraph);

        // Plays the Graph.

        playableGraph.Play();
    }
Beispiel #24
0
 /// <summary>
 /// Creates a mixer used to blend playables generated by clips on the track.
 /// </summary>
 /// <param name="graph">The graph to inject playables into</param>
 /// <param name="go">The GameObject that requested the graph.</param>
 /// <param name="inputCount">The number of playables from clips that will be inputs to the returned mixer</param>
 /// <returns>A handle to the [[Playable]] representing the mixer.</returns>
 /// <remarks>
 /// Override this method to provide a custom playable for mixing clips on a graph.
 /// </remarks>
 public virtual Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
 {
     return(Playable.Create(graph, inputCount));
 }
 public sealed override Playable CreatePlayable(PlayableGraph graph, GameObject go)
 {
     return(Playable.Create(graph));
 }
Beispiel #26
0
        // Token: 0x060001A3 RID: 419 RVA: 0x00008660 File Offset: 0x00006860
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            if (this.prefabGameObject != null)
            {
                if (s_CreatedPrefabs.Contains(this.prefabGameObject))
                {
                    Debug.LogWarningFormat("Control Track Clip ({0}) is causing a prefab to instantiate itself recursively. Aborting further instances.", new object[]
                    {
                        base.name
                    });
                    return(Playable.Create(graph, 0));
                }
                s_CreatedPrefabs.Add(this.prefabGameObject);
            }
            Playable        playable = Playable.Null;
            List <Playable> list     = new List <Playable>();
            GameObject      endGo    = this.sourceGameObject.Resolve(graph.GetResolver());
            GameObject      startGo  = this.startGameObject.Resolve(graph.GetResolver());

//#if UNITY_EDITOR
//            //得到TimelinClip,拿到时长
//            var director = go.GetComponent<PlayableDirector>();
//            var tlAsset = director.playableAsset as TimelineAsset;
//            foreach (var track in tlAsset.GetOutputTracks())
//            {
//                foreach (var clip in track.GetClips())
//                {
//                    if (clip.asset == this)
//                    {
//                        this.m_Duration = clip.duration;
//                        break;
//                    }
//                }
//            }
//#endif

            if (this.prefabGameObject != null)
            {
                Transform endTrans   = (!(endGo != null)) ? null : endGo.transform;
                Transform startTrans = (!(startGo != null)) ? null : startGo.transform;
                ScriptPlayable <FlyParticlePrefabControl> playable2 = FlyParticlePrefabControl.Create(
                    graph, this.prefabGameObject, startTrans, endTrans, startPosOffset, posOffset, followType, initResetRotate
                    , this.realLife, flyDuration, revert, scaleFactor
                    );
                endGo = playable2.GetBehaviour().prefabInstance;
                list.Add(playable2);
            }
            //this.m_Duration = PlayableBinding.DefaultDuration;
            this.m_SupportLoop = false;
            if (endGo != null)
            {
                IList <ParticleSystem> particleSystems = ((!this.updateParticle) || (realLife > 0f && Application.isPlaying))? k_EmptyParticlesList:this.GetParticleSystemRoots(endGo);

                PlayableDirector component = go.GetComponent <PlayableDirector>();
                if (component != null)
                {
                    this.m_ControlDirectorAsset = component.playableAsset;
                }
                if (go == endGo && this.prefabGameObject == null)
                {
                    Debug.LogWarningFormat("Control Playable ({0}) is referencing the same PlayableDirector component than the one in which it is playing.", new object[]
                    {
                        base.name
                    });
                    this.active = false;
                }
                if (this.active && realLife < 0.01f)
                {
                    this.CreateActivationPlayable(endGo, graph, list);
                }

                if (this.updateParticle)
                {
                    this.SearchHiearchyAndConnectParticleSystem(particleSystems, graph, list);
                }

                playable = ConnectPlayablesToMixer(graph, list);
            }



            if (this.prefabGameObject != null)
            {
                s_CreatedPrefabs.Remove(this.prefabGameObject);
            }
            if (!playable.IsValid <Playable>())
            {
                playable = Playable.Create(graph, 0);
            }
            return(playable);
        }
Beispiel #27
0
    // Factory method that generates a playable based on this asset
    public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
    {
        //return Playable.Create(graph);

        PlayableDirector pd = go.GetComponent <PlayableDirector>();

        //get binding object
        TrackAsset attTrack = null;
        TrackAsset tarTrack = null;

        foreach (var t in (pd.playableAsset as TimelineAsset).GetOutputTracks())
        {
            if (!(t is AnimationTrack) && !(t is LJ_TimelineExtension.AnimatorStateTrack))
            {
                continue;
            }
            if (attTrack == null && t.name.StartsWith(PDBH.AttackerTrackName))
            {
                attTrack = t;
            }
            else if (tarTrack == null && t.name.StartsWith(PDBH.TargetTrackName))
            {
                tarTrack = t;
            }
        }

        Transform attTrans = null;
        Transform tarTrans = null;

        if (attTrack != null)
        {
            var tmpAnim = pd.GetGenericBinding(attTrack) as Animator;
            if (tmpAnim != null)
            {
                attTrans = tmpAnim.transform;
            }
        }
        if (tarTrack != null)
        {
            var tmpAnim = pd.GetGenericBinding(tarTrack) as Animator;
            if (tmpAnim != null)
            {
                tarTrans = tmpAnim.transform;
            }
        }

        if (attTrans == null || tarTrans == null)
        {
            return(Playable.Create(graph));
        }

        Transform driveBone = attTrans.Find(DriveBoneName);
        Transform syncBone  = tarTrans.Find(SyncBoneName);


        var pb = ScriptPlayable <SetBoneSyncBehaviour> .Create(graph);

        var b = pb.GetBehaviour();

        b.syncRoot  = tarTrans.parent;
        b.driveBone = driveBone;
        b.syncBone  = syncBone;

        return(pb);
    }
Beispiel #28
0
 public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
 {
     //Weight won't appear if return Playable.Null here lol
     return(Playable.Create(graph));
 }
Beispiel #29
0
        // Token: 0x060001A3 RID: 419 RVA: 0x00008660 File Offset: 0x00006860
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            if (this.prefabGameObject != null)
            {
                if (s_CreatedPrefabs.Contains(this.prefabGameObject))
                {
                    Debug.LogWarningFormat("Control Track Clip ({0}) is causing a prefab to instantiate itself recursively. Aborting further instances.", new object[]
                    {
                        base.name
                    });
                    return(Playable.Create(graph, 0));
                }
                s_CreatedPrefabs.Add(this.prefabGameObject);
            }
            Playable        playable   = Playable.Null;
            List <Playable> list       = new List <Playable>();
            GameObject      gameObject = this.sourceGameObject.Resolve(graph.GetResolver());

            if (this.prefabGameObject != null)
            {
                Transform parentTransform = (!(gameObject != null)) ? null : gameObject.transform;
                ScriptPlayable <ParticlePrefabControl> playable2 = ParticlePrefabControl.Create(
                    graph, this.prefabGameObject, parentTransform, posOffset, followType, initResetRotate
                    , this.realLife, this.scaleFactor
                    );
                gameObject = playable2.GetBehaviour().prefabInstance;
                list.Add(playable2);
            }
            //this.m_Duration = PlayableBinding.DefaultDuration;

            this.m_SupportLoop = false;
            if (gameObject != null)
            {
                // IList<PlayableDirector> directors = (!this.updateDirector) ? TestControlPlayableAsset.k_EmptyDirectorsList : this.GetComponent<PlayableDirector>(gameObject);
                // IList<ParticleSystem> particleSystems = (!this.updateParticle) ? ParticleControlPlayableAsset.k_EmptyParticlesList : this.GetParticleSystemRoots(gameObject);
                IList <ParticleSystem> particleSystems = ((!this.updateParticle) || (realLife > 0f && Application.isPlaying)) ? ParticleControlPlayableAsset.k_EmptyParticlesList : this.GetParticleSystemRoots(gameObject);
                //this.UpdateDurationAndLoopFlag(directors, particleSystems);
                PlayableDirector component = go.GetComponent <PlayableDirector>();
                if (component != null)
                {
                    this.m_ControlDirectorAsset = component.playableAsset;
                }
                if (go == gameObject && this.prefabGameObject == null)
                {
                    Debug.LogWarningFormat("Control Playable ({0}) is referencing the same PlayableDirector component than the one in which it is playing.", new object[]
                    {
                        base.name
                    });
                    this.active = false;
                    //if (!this.searchHierarchy)
                    //{
                    //    //this.updateDirector = false;
                    //}
                }
                if (this.active && realLife < 0.01f)
                {
                    this.CreateActivationPlayable(gameObject, graph, list);
                }
                //if (this.updateDirector)
                //{
                //    this.SearchHierarchyAndConnectDirector(directors, graph, list, this.prefabGameObject != null);
                //}
                if (this.updateParticle)
                {
                    this.SearchHiearchyAndConnectParticleSystem(particleSystems, graph, list);
                }
                //if (this.updateITimeControl)
                //{
                //    TestControlPlayableAsset.SearchHierarchyAndConnectControlableScripts(TestControlPlayableAsset.GetControlableScripts(gameObject), graph, list);
                //}
                playable = ParticleControlPlayableAsset.ConnectPlayablesToMixer(graph, list);
            }
            if (this.prefabGameObject != null)
            {
                s_CreatedPrefabs.Remove(this.prefabGameObject);
            }
            if (!playable.IsValid <Playable>())
            {
                playable = Playable.Create(graph, 0);
            }
            return(playable);
        }
        /// <summary>
        /// Creates the root of a Playable subgraph to control the contents of the game object.
        /// </summary>
        /// <param name="graph">PlayableGraph that will own the playable</param>
        /// <param name="go">The GameObject that triggered the graph build</param>
        /// <returns>The root playable of the subgraph</returns>
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            // case 989856
            if (prefabGameObject != null)
            {
                if (s_CreatedPrefabs.Contains(prefabGameObject))
                {
                    Debug.LogWarningFormat("Control Track Clip ({0}) is causing a prefab to instantiate itself recursively. Aborting further instances.", name);
                    return(Playable.Create(graph));
                }
                s_CreatedPrefabs.Add(prefabGameObject);
            }

            Playable root      = Playable.Null;
            var      playables = new List <Playable>();

            GameObject sourceObject = sourceGameObject.Resolve(graph.GetResolver());

            if (prefabGameObject != null)
            {
                Transform parenTransform  = sourceObject != null ? sourceObject.transform : null;
                var       controlPlayable = PrefabControlPlayable.Create(graph, prefabGameObject, parenTransform);

                sourceObject = controlPlayable.GetBehaviour().prefabInstance;
                playables.Add(controlPlayable);
            }

            m_Duration    = PlayableBinding.DefaultDuration;
            m_SupportLoop = false;

            if (sourceObject != null)
            {
                var directors       = updateDirector ? GetComponent <PlayableDirector>(sourceObject) : k_EmptyDirectorsList;
                var particleSystems = updateParticle ? GetParticleSystemRoots(sourceObject) : k_EmptyParticlesList;

                // update the duration and loop values (used for UI purposes) here
                // so they are tied to the latest gameObject bound
                UpdateDurationAndLoopFlag(directors, particleSystems);

                var director = go.GetComponent <PlayableDirector>();
                if (director != null)
                {
                    m_ControlDirectorAsset = director.playableAsset;
                }

                if (go == sourceObject && prefabGameObject == null)
                {
                    Debug.LogWarningFormat("Control Playable ({0}) is referencing the same PlayableDirector component than the one in which it is playing.", name);
                    active = false;
                    if (!searchHierarchy)
                    {
                        updateDirector = false;
                    }
                }

                if (active)
                {
                    CreateActivationPlayable(sourceObject, graph, playables);
                }

                if (updateDirector)
                {
                    SearchHierarchyAndConnectDirector(directors, graph, playables, prefabGameObject != null);
                }

                if (updateParticle)
                {
                    SearchHiearchyAndConnectParticleSystem(particleSystems, graph, playables);
                }

                if (updateITimeControl)
                {
                    SearchHierarchyAndConnectControlableScripts(GetControlableScripts(sourceObject), graph, playables);
                }

                // Connect Playables to Generic to Mixer
                root = ConnectPlayablesToMixer(graph, playables);
            }

            if (prefabGameObject != null)
            {
                s_CreatedPrefabs.Remove(prefabGameObject);
            }

            if (!root.IsValid())
            {
                root = Playable.Create(graph);
            }

            return(root);
        }