Пример #1
0
        public void SteerClip(GameObject go, Vector3 startPos, Vector3 goalPos, bool depart, bool arrival, bool isMaster, ClipInfo CI)
        {
            var steerClip = steerTrack.CreateClip <SteeringAsset>();

            steerClip.start       = CI.start;
            steerClip.duration    = CI.duration;
            steerClip.displayName = CI.display;
            SteeringAsset steer_clip = steerClip.asset as SteeringAsset;

            SteerBind(steer_clip, go, startPos, goalPos, depart, arrival, isMaster);
        }
 public override void OnCreate(TrackAsset track, TrackAsset copiedFrom)
 {
     base.OnCreate(track, copiedFrom);
     if (copiedFrom == null && track.isEmpty)
     {
         track.CreateClip <VisualEffectControlClip>();
     }
 }
Пример #3
0
        public DragAndDropVisualMode HandleGameObjectDrop(TreeViewItem parentItem, TreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
        {
            DragAndDropVisualMode result;

            if (parentItem != null || targetItem != null)
            {
                result = 0;
            }
            else if (!DragAndDrop.get_objectReferences().Any((Object x) => x is GameObject))
            {
                result = 0;
            }
            else if (this.m_Window.state.currentDirector == null)
            {
                result = 32;
            }
            else
            {
                if (perform)
                {
                    Object[] objectReferences = DragAndDrop.get_objectReferences();
                    for (int i = 0; i < objectReferences.Length; i++)
                    {
                        Object     @object = objectReferences[i];
                        GameObject go      = @object as GameObject;
                        if (!(go == null))
                        {
                            PrefabType prefabType = PrefabUtility.GetPrefabType(go);
                            if (prefabType != 1 && prefabType != 2)
                            {
                                IEnumerable <TrackType> enumerable = from x in TimelineHelpers.GetMixableTypes()
                                                                     where x.requiresGameObjectBinding
                                                                     select x;
                                GenericMenu genericMenu = new GenericMenu();
                                foreach (TrackType current in enumerable)
                                {
                                    genericMenu.AddItem(new GUIContent(TimelineHelpers.GetTrackMenuName(current)), false, delegate(object e)
                                    {
                                        TrackAsset trackAsset = this.m_Window.AddTrack(((TrackType)e).trackType, null, string.Empty);
                                        if (trackAsset.GetType() == typeof(ActivationTrack))
                                        {
                                            TimelineClip timelineClip = trackAsset.CreateClip(0.0);
                                            timelineClip.displayName  = ActivationTrackDrawer.Styles.ClipText.get_text();
                                        }
                                        this.m_Window.state.previewMode = false;
                                        TimelineUtility.SetSceneGameObject(this.m_Window.state.currentDirector, trackAsset, go);
                                    }, current);
                                }
                                genericMenu.ShowAsContext();
                            }
                            this.m_Window.state.Refresh();
                        }
                    }
                }
                result = 1;
            }
            return(result);
        }
 public override void OnCreate(TrackAsset track, TrackAsset copiedFrom)
 {
     // Add a default clip to the newly created track
     if (copiedFrom == null)
     {
         var clip = track.CreateClip(0);
         clip.displayName = ClipText;
         clip.duration    = System.Math.Max(clip.duration, track.timelineAsset.duration * 0.5f);
     }
 }
        public virtual TimelineClip CreateClip(float start, float duration, string displayName)
        {
            TimelineClip tc;

            if (!FreeInterval(start, start + duration, TimelineClips))
            {
                trackNum++;
                currentTrack  = timeline.CreateTrack <PlayableTrack>(null, name + trackNum.ToString());
                TimelineClips = new List <TimelineClip>();
            }

            tc = currentTrack.CreateClip <LerpMoveObjectAsset>();

            tc.start       = start;
            tc.duration    = duration;
            tc.displayName = displayName;

            TimelineClips.Add(tc);
            return(tc);
        }
        private void CreateRhubarb()
        {
            TimelineAsset timelineAsset = (TimelineAsset)_timeline.playableAsset;
            TrackAsset    track         = null;

            switch (_rhubarbBindType)
            {
            case RhubarbBindType.Sprite:
                track = timelineAsset.CreateTrack <RhubarbPlayableSpriteTrack>(null, "Rhubarb Sprite Track");
                _timeline.SetGenericBinding(track, _rhubarbSprite);
                break;

            case RhubarbBindType.Material:
                track = timelineAsset.CreateTrack <RhubarbPlayableMaterialTrack>(null, "Rhubarb Material Track");
                _timeline.SetGenericBinding(track, _rhubarbMaterial);
                break;
            }

            if (track == null)
            {
                return;
            }

            string       audioPath    = Path.Combine(Directory.GetCurrentDirectory(), AssetDatabase.GetAssetPath(_audioClip));
            RhubarbTrack rhubarbTrack = RhubarbEditorProcess.Auto(_rhubarbPath, audioPath, _isUseDialog ? _dialogText : null, _isMouthShapeG, _isMouthShapeH, _isMouthShapeX);

            for (int i = 0; i < rhubarbTrack.keyframes.Count - 1; i++)
            {
                RhubarbKeyframe keyframe     = rhubarbTrack.keyframes[i];
                RhubarbKeyframe nextKeyframe = rhubarbTrack.keyframes[i + 1];
                TimelineClip    clip         = track.CreateClip <RhubarbPlayableClip>();
                clip.start    = Rhubarb.FrameToTime(keyframe.frame);
                clip.duration = Rhubarb.FrameToTime(nextKeyframe.frame - keyframe.frame);
                ((RhubarbPlayableClip)clip.asset).template.MouthShape = keyframe.phoneme;
            }
        }