コード例 #1
0
        public sealed override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            ScriptPlayable <ArgumentPlayableBehaviour> playable = ScriptPlayable <ArgumentPlayableBehaviour> .Null;
            ScriptPlayable <ArgumentPlayableBehaviour> templete = ScriptPlayable <ArgumentPlayableBehaviour> .Null;

            for (int i = 0; i < graph.GetRootPlayableCount(); i++)
            {
                if (graph.GetRootPlayable(i).GetPlayableType().IsTypeOrSubTypeOf(typeof(ArgumentPlayableBehaviour)))
                {
                    templete = (ScriptPlayable <ArgumentPlayableBehaviour>)graph.GetRootPlayable(i);
                }
            }
            OnBeforeCreateArgumentPlayable(graph, owner);
            if (!templete.Equals(playable))
            {
                playable = (ScriptPlayable <ArgumentPlayableBehaviour>)OnCreateArgumentPlayable(graph, owner);
                ArgumentPlayableBehaviour behaviour = playable.GetBehaviour();
                director                = owner.GetComponent <PlayableDirector>();
                timeline                = (TimelineAsset)director.playableAsset;
                trackAsset              = templete.GetBehaviour().trackAsset;
                timelineClip            = trackAsset.FindTimelineClip(this);
                genericBindingObject    = director.GetGenericBinding(trackAsset);
                behaviour.playableAsset = this;
                OnAfterCreateArgumentPlayable(graph, owner, playable);
            }
            return(playable);
        }
コード例 #2
0
ファイル: AnimatorHandler.cs プロジェクト: Farl/SSCore2017
    private void RecursiveDump(PlayableGraph graph)
    {
        var count = graph.GetRootPlayableCount();

        for (int i = 0; i < count; i++)
        {
            var p = graph.GetRootPlayable(i);
            Debug.Log(p.ToString());
            RecursiveDump(p);
        }
    }
コード例 #3
0
        public static T FindOutput <T>(PlayableGraph graph, bool recursive = false) where T : PlayableBehaviour, new()
        {
            int outputs = graph.GetRootPlayableCount();

            for (int i = 0; i < outputs; i++)
            {
                var found = FindOutput <T>(graph.GetRootPlayable(i), recursive);
                if (found != null)
                {
                    return(found);
                }
            }
            return(null);
        }
コード例 #4
0
            public static PlayableBehaviour GetTrackMixer(PlayableGraph graph, TrackAsset track, Type type)
            {
                int rootCount = graph.GetRootPlayableCount();

                for (int i = 0; i < rootCount; i++)
                {
                    Playable root = graph.GetRootPlayable(i);

                    PlayableBehaviour trackMixer = GetTrackMixer(root, track, type);

                    if (trackMixer != null)
                    {
                        return(trackMixer);
                    }
                }

                return(null);
            }
コード例 #5
0
            //Finds the track mixer for a track given a playable graph instance
            public static T GetTrackMixer <T>(PlayableGraph graph, TrackAsset track) where T : class, IPlayableBehaviour, ITrackMixer, new()
            {
                int rootCount = graph.GetRootPlayableCount();

                for (int i = 0; i < rootCount; i++)
                {
                    Playable root = graph.GetRootPlayable(i);

                    T trackMixer = GetTrackMixer <T>(root, track);

                    if (trackMixer != null)
                    {
                        return(trackMixer);
                    }
                }

                return(null);
            }
コード例 #6
0
 public static IEnumerable <T> EnumerateBehaviours <T>(PlayableGraph playableGraph) where T : class, IPlayableBehaviour, new()
 {
     //IL_0008: Unknown result type (might be due to invalid IL or missing references)
     //IL_0009: Unknown result type (might be due to invalid IL or missing references)
     if (playableGraph.IsValid())
     {
         int rootPlayableCount = playableGraph.GetRootPlayableCount();
         int num;
         for (int rootPlayableIndex = 0; rootPlayableIndex < rootPlayableCount; rootPlayableIndex = num)
         {
             Playable rootPlayable = playableGraph.GetRootPlayable(rootPlayableIndex);
             foreach (T item in EnumerateBehaviours <T>(rootPlayable))
             {
                 yield return(item);
             }
             num = rootPlayableIndex + 1;
         }
     }
 }
コード例 #7
0
            //Get all playable behaviours in a playable graph of type T, or implementing interface of type T
            public static List <T> GetPlayableBehaviours <T>(PlayableGraph graph) where T : class
            {
                List <T> playables = new List <T>();

                int rootCount = graph.GetRootPlayableCount();

                for (int i = 0; i < rootCount; i++)
                {
                    Playable root = graph.GetRootPlayable(i);

                    int inputCount = root.GetInputCount();;

                    for (int j = 0; j < inputCount; j++)
                    {
                        GetPlayableBehaviours(root.GetInput(j), ref playables);
                    }
                }

                return(playables);
            }