示例#1
0
        public static void SetSceneGameObject(PlayableDirector director, TrackAsset asset, GameObject go)
        {
            if (director == null || asset == null)
            {
                return;
            }

            asset = GetSceneReferenceTrack(asset);
            var bindings = asset.outputs;

            if (bindings.Count() == 0)
            {
                return;
            }

            var binding = bindings.First();

            if (binding.outputTargetType == typeof(GameObject))
            {
                BindingUtility.Bind(director, asset, go);
            }
            else
            {
                BindingUtility.Bind(director, asset, TimelineHelpers.AddRequiredComponent(go, asset));
            }
        }
 public static void SetSceneGameObject(PlayableDirector director, TrackAsset asset, GameObject go)
 {
     if (!(director == null) && !(asset == null))
     {
         asset = TimelineUtility.GetSceneReferenceTrack(asset);
         IEnumerable <PlayableBinding> outputs = asset.get_outputs();
         if (outputs.Count <PlayableBinding>() != 0)
         {
             PlayableBinding playableBinding = outputs.First <PlayableBinding>();
             if (playableBinding.get_streamType() == null || playableBinding.get_sourceBindingType() == typeof(GameObject))
             {
                 TimelineHelpers.AddRequiredComponent(go, asset);
                 TimelineUtility.SetBindingInDirector(director, asset, go);
             }
             else
             {
                 TimelineUtility.SetBindingInDirector(director, asset, TimelineHelpers.AddRequiredComponent(go, asset));
             }
         }
     }
 }