コード例 #1
0
 void Start()
 {
     timeline = GetComponent <PlayableDirector>();
 }
コード例 #2
0
        // because we may be evaluating outside the duration of the root playable
        //  we explicitly set the time - this causes the graph to not 'advance' the time
        //  because advancing it can force it to change due to wrapping to the duration
        // This can happen if the graph is force evaluated outside it's duration
        // case 910114, 936844 and 943377
        static void ForceTimeOnDirector(PlayableDirector director)
        {
            var directorTime = director.time;

            director.time = directorTime;
        }
コード例 #3
0
 /// <summary>
 /// 暂停
 /// </summary>
 /// <param name="diretor"></param>
 public static void Pause(PlayableDirector diretor)
 {
     diretor.Pause();
 }
コード例 #4
0
 private void Start()
 {
     Manager          = DeterminismManager.Instance;
     BossComeTimeLine = GetComponent <PlayableDirector>();
 }
コード例 #5
0
        internal static void DuplicateBindings(TrackAsset track, TrackAsset newTrack, PlayableDirector director)
        {
            var originalTracks = track.GetFlattenedChildTracks().Append(track);
            var newTracks      = newTrack.GetFlattenedChildTracks().Append(newTrack);
            var toBind         = new List <Tuple <TrackAsset, Object> >();

            // Collect all track bindings to duplicate
            var originalIt = originalTracks.GetEnumerator();
            var newIt      = newTracks.GetEnumerator();

            while (originalIt.MoveNext() && newIt.MoveNext())
            {
                var binding = director.GetGenericBinding(originalIt.Current);
                if (binding != null)
                {
                    toBind.Add(new Tuple <TrackAsset, Object>(newIt.Current, binding));
                }
            }

            //Only create Director undo if there are bindings to duplicate
            if (toBind.Count > 0)
            {
                TimelineUndo.PushUndo(TimelineEditor.inspectedDirector, L10n.Tr("Duplicate"));
            }

            //Assign bindings for all tracks after undo.
            foreach (var binding in toBind)
            {
                TimelineEditor.inspectedDirector.SetGenericBinding(binding.Item1, binding.Item2);
            }
        }
コード例 #6
0
 public void EnterCutscene(PlayableDirector aDirector)
 {
     SwitchPlayerState(PlayerState.cutscene);
     LockMovement();
 }
コード例 #7
0
 private void stoped(PlayableDirector s)
 {
     CharacterControl.Instance.m_Agent.speed   = 10;
     CharacterControl.Instance.Speed           = 10f;
     CharacterControl.Instance.Data.invincible = false;
 }
コード例 #8
0
        static bool ValidateSubElements(List <SequencePathSubElement> subElements, PlayableDirector director, out List <SequenceBuildingBlock> buildingBlocks)
        {
            buildingBlocks = new List <SequenceBuildingBlock>(subElements.Count);
            var currentDirector = director;

            foreach (var element in subElements)
            {
                var timeline = currentDirector.playableAsset as TimelineAsset;
                if (timeline == null)
                {
                    return(false);
                }
                if (timeline.trackObjects == null)
                {
                    return(false);
                }

                var track = timeline.GetOutputTracks().FirstOrDefault(t => t.GetInstanceID() == element.trackInstanceID);
                if (track == null)
                {
                    return(false);
                }
                if (track.Hash() != element.trackHash)
                {
                    return(false);
                }
                if (track.clips == null)
                {
                    return(false);
                }
                if (track.clips.Length <= element.clipIndex)
                {
                    return(false);
                }

                var clip = track.clips[element.clipIndex];
                if (clip == null)
                {
                    return(false);
                }
                if (clip.Hash() != element.clipHash)
                {
                    return(false);
                }

                var candidateDirectors = TimelineUtility.GetSubTimelines(clip, director);

                if (element.subDirectorIndex < 0 || element.subDirectorIndex >= candidateDirectors.Count)
                {
                    return(false);
                }

                var candidateDirector = candidateDirectors[element.subDirectorIndex];

                if (candidateDirector == null || !(candidateDirector.playableAsset is TimelineAsset))
                {
                    return(false);
                }

                currentDirector = candidateDirector;

                buildingBlocks.Add(
                    new SequenceBuildingBlock
                {
                    asset    = currentDirector.playableAsset as TimelineAsset,
                    director = currentDirector,
                    hostClip = clip
                });
            }

            return(true);
        }
        public static void MatchNext(TimelineClip currentClip, Transform matchPoint, PlayableDirector director)
        {
            const double      timeEpsilon = 0.00001;
            MatchTargetFields matchFields = GetMatchFields(currentClip);

            if (matchFields == MatchTargetFieldConstants.None || matchPoint == null)
            {
                return;
            }

            double cachedTime = director.time;

            // finds next clip
            TimelineClip nextClip = GetNextClip(currentClip);

            if (nextClip == null || currentClip == nextClip)
            {
                return;
            }

            // make sure the transform is properly updated before modifying the graph
            director.Evaluate();

            var parentTrack = currentClip.parentTrack as AnimationTrack;

            var blendOut = currentClip.blendOutDuration;
            var blendIn  = nextClip.blendInDuration;

            currentClip.blendOutDuration = 0;
            nextClip.blendInDuration     = 0;

            //evaluate previous without current
            parentTrack.RemoveClip(currentClip);
            director.RebuildGraph();
            director.time = nextClip.start + timeEpsilon;
            director.Evaluate(); // add port to evaluate only track

            var targetPosition = matchPoint.position;
            var targetRotation = matchPoint.rotation;

            // evaluate current without next
            parentTrack.AddClip(currentClip);
            parentTrack.RemoveClip(nextClip);
            director.RebuildGraph();
            director.time = Math.Min(nextClip.start, currentClip.end - timeEpsilon);
            director.Evaluate();

            //////////////////////////////////////////////////////////////////////
            //compute offsets

            var animationPlayable = currentClip.asset as AnimationPlayableAsset;
            var match             = UpdateClipOffsets(animationPlayable, parentTrack, matchPoint, targetPosition, targetRotation);

            WriteMatchFields(animationPlayable, match, matchFields);

            //////////////////////////////////////////////////////////////////////

            currentClip.blendOutDuration = blendOut;
            nextClip.blendInDuration     = blendIn;

            parentTrack.AddClip(nextClip);
            director.RebuildGraph();
            director.time = cachedTime;
            director.Evaluate();
        }
コード例 #10
0
 private void BossAndDoctor_play(PlayableDirector obj)
 {
     StartCoroutine(Timer(timeline));
 }
コード例 #11
0
 private void ComeIn_played(PlayableDirector obj)
 {
     StartCoroutine(Timer(comeIn));
 }
コード例 #12
0
 // Start is called before the first frame update
 void Start()
 {
     //同じゲームオブジェクトにあるPlayableDirectorを取得する
     playableDirector = GetComponent <PlayableDirector>();
 }
コード例 #13
0
 void Start()
 {
     Cursor.visible   = false;
     playableDirector = GetComponent <PlayableDirector>();
     playableDirector.Play();
 }
コード例 #14
0
 public void WhenEnded(PlayableDirector obj)
 {
     GameManager.gameManager.isCutScene = false;
     GameData.previousScene             = 9;
     SceneManager.LoadScene(10);
 }
コード例 #15
0
ファイル: CinemaController.cs プロジェクト: MrEk0/RPG
 void DisableControl(PlayableDirector pd)
 {
     print("Stop Moving!");
     player.GetComponent <Player>().enabled = false;
 }
コード例 #16
0
 private void HandleDirectorStopped(PlayableDirector director) => CutsceneEnded();
コード例 #17
0
ファイル: CinemaController.cs プロジェクト: MrEk0/RPG
 void EnableControl(PlayableDirector pd)
 {
     player.GetComponent <Player>().enabled = true;
     print("We are able to move!");
 }
コード例 #18
0
        /// <summary>
        /// Creates a Playable with a DirectorControlPlayable attached
        /// </summary>
        /// <param name="graph">The graph to inject the playable into</param>
        /// <param name="director">The director to control</param>
        /// <returns>Returns a Playable with a DirectorControlPlayable attached</returns>
        public static ScriptPlayable <DirectorControlPlayable> Create(PlayableGraph graph, PlayableDirector director)
        {
            if (director == null)
            {
                return(ScriptPlayable <DirectorControlPlayable> .Null);
            }

            var handle = ScriptPlayable <DirectorControlPlayable> .Create(graph);

            handle.GetBehaviour().director = director;

#if UNITY_EDITOR
            if (!Application.isPlaying && UnityEditor.PrefabUtility.IsPartOfPrefabInstance(director))
            {
                UnityEditor.PrefabUtility.prefabInstanceUpdated += handle.GetBehaviour().OnPrefabUpdated;
            }
#endif

            return(handle);
        }
コード例 #19
0
 public void ExitCutscene(PlayableDirector aDirector)
 {
     SwitchPlayerState(PlayerState.normal);
     UnlockMovement();
 }
コード例 #20
0
        /// <summary>
        /// Call this at the start of an Interaction engine test with the name of a stage
        /// object and the name of a rig object to load those objects and fill utility
        /// parameters such as manager, leftHand, box0, etc. for testing.
        /// </summary>
        protected void InitTest(string rigObjName, string stageObjName)
        {
            // Load test rig objects.
            base.InitTest(rigObjName);
            rigObj    = testObj;
            recording = rigObj.GetComponentInChildren <PlayableDirector>();
            provider  = rigObj.GetComponentInChildren <LeapProvider>();
            manager   = rigObj.GetComponentInChildren <InteractionManager>();

            foreach (var controller in manager.interactionControllers)
            {
                if (controller.intHand != null && controller.isLeft)
                {
                    leftHand = controller.intHand;
                    continue;
                }
                if (controller.intHand != null && !controller.isLeft)
                {
                    rightHand = controller.intHand;
                    continue;
                }

                var vrController = controller as InteractionVRController;
                if (vrController != null && vrController.isLeft)
                {
                    leftVRController = vrController;
                    continue;
                }
                if (vrController != null && !vrController.isLeft)
                {
                    rightVRController = vrController;
                    continue;
                }
            }

            // Load stage objects.
            stageObj = LoadObject(stageObjName);

            var intObjs = Pool <List <InteractionBehaviour> > .Spawn();

            try {
                stageObj.GetComponentsInChildren <InteractionBehaviour>(true, intObjs);

                // Load "simple box" interaction objects.
                foreach (var simpleBoxObj in intObjs
                         .Query()
                         .Where(o => o.primaryHoverColliders.Count == 1 &&
                                o.primaryHoverColliders[0] is BoxCollider &&
                                !o.ignoreContact &&
                                !o.ignoreGrasping))
                {
                    if (box0 == null)
                    {
                        box0 = simpleBoxObj; continue;
                    }
                    if (box1 == null)
                    {
                        box1 = simpleBoxObj; continue;
                    }
                    if (box2 == null)
                    {
                        box2 = simpleBoxObj; continue;
                    }
                }

                foreach (var interactionButtonObj in intObjs.Query()
                         .Where(o => o is InteractionButton))
                {
                    if (button == null)
                    {
                        button = interactionButtonObj as InteractionButton;
                    }
                }
            }
            finally {
                intObjs.Clear();
                Pool <List <InteractionBehaviour> > .Recycle(intObjs);
            }
        }
コード例 #21
0
 private void Start()
 {
     timeline = timelineGO.GetComponent <PlayableDirector>();
 }
コード例 #22
0
ファイル: StaffRoll.cs プロジェクト: Shi-553/GameTaisyo2
 void Start()
 {
     playableDirector = GetComponent <PlayableDirector>();
 }
コード例 #23
0
 public void PlayCutscene(int cutSceneIndex)
 {
     //ayableDirector[cutSceneIndex].Play();
     currentDirector = playableDirector[cutSceneIndex];
     currentDirector.Play();
 }
コード例 #24
0
 void Reset()
 {
     playableDirector = GetComponent <PlayableDirector>();
 }
コード例 #25
0
 public override void OnPlayableCreate(Playable playable)
 {
     Director = playable.GetGraph().GetResolver() as PlayableDirector;
 }
コード例 #26
0
 void DisableControl(PlayableDirector pd)
 {
     player.GetComponent <ActionScheduler>().CancelCurrentAction();
     player.GetComponent <PlayerController>().enabled = false;
 }
コード例 #27
0
ファイル: ActionTimeline.cs プロジェクト: ManuelAGC/StarEater
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            method = (ActionDirectorMethod)EditorGUILayout.EnumPopup("Method:", method);

            directorParameterID = Action.ChooseParameterGUI("Director:", parameters, directorParameterID, ParameterType.GameObject);
            if (directorParameterID >= 0)
            {
                directorConstantID = 0;
                director           = null;
            }
            else
            {
                director = (PlayableDirector)EditorGUILayout.ObjectField("Director:", director, typeof(PlayableDirector), true);

                directorConstantID = FieldToID <PlayableDirector> (director, directorConstantID);
                director           = IDToField <PlayableDirector> (director, directorConstantID, false);
            }

            if (director != null || directorParameterID >= 0)
            {
                if (method == ActionDirectorMethod.Play)
                {
                    restart = EditorGUILayout.Toggle("Play from beginning?", restart);
                    if (restart)
                    {
                        newTimeline    = (TimelineAsset)EditorGUILayout.ObjectField("Timeline (optional):", newTimeline, typeof(TimelineAsset), false);
                        updateBindings = EditorGUILayout.Toggle("Remap bindings?", updateBindings);
                        if (updateBindings)
                        {
                            if (newTimeline)
                            {
                                ShowBindingsUI(newTimeline, parameters);
                            }
                            else if (director != null && director.playableAsset != null)
                            {
                                ShowBindingsUI(director.playableAsset as TimelineAsset, parameters);
                            }
                            else
                            {
                                EditorGUILayout.HelpBox("A Director or Timeline must be assigned in order to update bindings.", MessageType.Warning);
                            }
                        }
                        else if (newTimeline != null)
                        {
                            EditorGUILayout.HelpBox("The existing bindings will be transferred onto the new Timeline.", MessageType.Info);
                        }
                    }
                    willWait = EditorGUILayout.Toggle("Wait until finish?", willWait);

                    if (willWait)
                    {
                        disableCamera = EditorGUILayout.Toggle("Disable AC camera?", disableCamera);
                    }
                }
                else if (method == ActionDirectorMethod.Stop)
                {
                    pause         = EditorGUILayout.Toggle("Pause timeline?", pause);
                    disableCamera = EditorGUILayout.Toggle("Enable AC camera?", disableCamera);
                }
            }

            AfterRunningOption();
        }
コード例 #28
0
 void EnableControl(PlayableDirector pd)
 {
     player.GetComponent <PlayerController>().enabled = true;
 }
コード例 #29
0
 /// <summary>
 /// 继续播放
 /// </summary>
 /// <param name="diretor"></param>
 public static void Resume(PlayableDirector diretor)
 {
     diretor.Resume();
 }
コード例 #30
0
 // Start is called before the first frame update
 void Awake()
 {
     director = GetComponent <PlayableDirector>();
 }