public void PerformScriptedAction(Enums.ScriptActionType action, params object[] data) { switch (action) { case Enums.ScriptActionType.PlayTimeline: int sequenceIndex = (int)data[0]; PlayEncounter(currentConfig.sequence[sequenceIndex].timelineName); break; case Enums.ScriptActionType.PauseTimeline: director.Pause(); break; case Enums.ScriptActionType.ReadDialogue: StartCoroutine(ReadDialogue((string)data[1], (float)data[2], (bool)data[3])); break; case Enums.ScriptActionType.ReadDialogueWaitForInput: StartCoroutine(ReadDialogue((string)data[1], (float)data[2], (bool)data[3])); waitingForInput = true; break; case Enums.ScriptActionType.WaitForChoice: director.Pause(); break; case Enums.ScriptActionType.DrawEnemyDeck: Main.instance.GetCombatStateMachine().DrawEnemyDeck(); break; case Enums.ScriptActionType.TransitionToEncounter: Main.instance.StartEncounter((Enums.EncounterID)data[4]); break; case Enums.ScriptActionType.EndCombat: EndEncounter(); break; } currentScriptedAction = action; if ((bool)data[5] == true) { Main.instance.ScriptedPlayerTurn(); } }
public override void ProcessFrame(Playable playable, FrameData info, object playerData) { //ScriptPlayable<TimeMachineBehaviour> inputPlayable = (ScriptPlayable<TimeMachineBehaviour>)playable.GetInput(i); //Debug.Log(PlayableExtensions.GetTime<ScriptPlayable<TimeMachineBehaviour>>(inputPlayable)); if (!Application.isPlaying) { return; } int inputCount = playable.GetInputCount(); for (int i = 0; i < inputCount; i++) { float inputWeight = playable.GetInputWeight(i); ScriptPlayable <TimeMachineBehaviour> inputPlayable = (ScriptPlayable <TimeMachineBehaviour>)playable.GetInput(i); TimeMachineBehaviour input = inputPlayable.GetBehaviour(); if (inputWeight > 0f) { if (!input.clipExecuted) { switch (input.action) { case TimeMachineBehaviour.TimeMachineAction.Pause: if (input.ConditionMet()) { director.Pause(); input.clipExecuted = true; //this prevents the command to be executed every frame of this clip } break; case TimeMachineBehaviour.TimeMachineAction.JumpToTime: case TimeMachineBehaviour.TimeMachineAction.JumpToMarker: if (input.ConditionMet()) { //Rewind if (input.action == TimeMachineBehaviour.TimeMachineAction.JumpToTime) { //Jump to time (playable.GetGraph().GetResolver() as PlayableDirector).time = (double)input.timeToJumpTo; } else { //Jump to marker double t = markerClips[input.markerToJumpTo]; (playable.GetGraph().GetResolver() as PlayableDirector).time = t; } input.clipExecuted = false; //we want the jump to happen again! } break; } } } } }
public void WaitForUserContinue(int step) { if (m_Step + 1 != step) { return; } director.Pause(); m_Step = step; m_isWaitingForInput = true; }
void timelineAction() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { return; } timeline.Pause(); }
void PlayStateEndAnim() { director.time -= Time.deltaTime; director.Evaluate(); if (director.time <= 0) { director.time = 0; director.Pause(); engine -= PlayStateEndAnim; } }
public override void OnBehaviourPause(Playable playable, FrameData info) { if (pauseScheduled) { pauseScheduled = false; director.Pause(); } else { } }
/// <summary> /// Restart the show /// </summary> public void RestartShow() { if (presentationSlides.Count > 0) { Turn_On_Off_Slide(presentationSlides[slideIndex], false); slideIndex = 0; Turn_On_Off_Slide(presentationSlides[slideIndex], true); PlaySelectedTimelineByIndex(slideIndex); timelineDirector.Play(); timelineDirector.Pause(); } }
public void Pause() { if (currentPlayableDirector == null) { return; } if (currentPlayableDirector.state == PlayState.Paused) { return; } currentPlayableDirector.Pause(); }
public override TaskStatus OnUpdate() { if (playableDirector == null) { Debug.LogWarning("PlayableDirector is null"); return(TaskStatus.Failure); } playableDirector.Pause(); return(TaskStatus.Success); }
void OnPause(GameObject instigator = null) { if (director.state == PlayState.Playing) { director.Pause(); wasPlaying = true; } else { wasPlaying = false; } }
// Update is called once per frame void Update() { Timer += Time.deltaTime; if (myDirector.time > 55f) { for (int i = 0; i < DestroyThemAll.Length; i++) { Destroy(DestroyThemAll[i]); } myDirector.Pause(); } }
void TimelineEffect(string _effect) { switch (_effect) { case "play": timeline.Play(); break; case "pause": timeline.Pause(); break; } }
private void OnShowTutorial(TutorialKey key) { switch (key) { case TutorialKey.Welcome: deliveryDirector.Pause(); ShowContinueButton(); break; case TutorialKey.MorningDelivery: deliveryDirector.Pause(); ShowContinueButton(); break; case TutorialKey.MorningDeliveryDone: break; case TutorialKey.ItemSetup: itemSetupDirector.Pause(); break; case TutorialKey.ItemSetupFront: itemSetupDirector.Pause(); break; case TutorialKey.ItemSetupPull: itemSetupDirector.Pause(); break; case TutorialKey.ItemSetupReady: break; case TutorialKey.AutoSales: break; default: throw new ArgumentOutOfRangeException(nameof(key), key, null); } }
private void SyncPlayState(PlayableGraph graph, double playableTime) { bool outOfRange = playableTime >= m_AssetDuration && director.extrapolationMode == DirectorWrapMode.None; if (graph.IsPlaying() && !outOfRange) { director.Play(); } else { director.Pause(); } }
public void PDirPauser() { if (isPlaying) { playableDirector.Pause(); isPlaying = false; } else { playableDirector.Resume(); isPlaying = true; } }
internal void Update(float deltaTime) { if (_isControlling && _isCapturing) { if (_director != null && _director.isActiveAndEnabled) { if (_director.state == PlayState.Playing) { double time = _director.time + deltaTime; if (time < _director.duration) { _director.time = time; _director.Evaluate(); } else { switch (_director.extrapolationMode) { case DirectorWrapMode.Loop: _director.time = time % _director.duration; _director.Evaluate(); break; case DirectorWrapMode.Hold: _director.time = _director.duration; _director.Evaluate(); break; case DirectorWrapMode.None: _director.time = 0f; _director.Pause(); break; } } } } } }
private void PauseLevelEvent_Handler(bool paused) { if (paused && _playableDirector.state != PlayState.Paused) { _playableDirector.Pause(); } if (!paused && _playableDirector.state == PlayState.Paused) { _playableDirector.Resume(); } Debug.Log("TimeLine time " + _playableDirector.time); }
// Called when the state of the playable is set to Play public override void OnBehaviourPlay(Playable playable, FrameData info) { if (!isInit) { thisDirector = GameObject.Find("StageManager").GetComponent <PlayableDirector> (); if (thisDirector) { thisDirector.Pause(); Boss = GameObject.Instantiate(BossPrefab, pos, Quaternion.identity); } isInit = true; } }
public void OnNotify(Playable origin, INotification notification, object context) { // ------------- if (notification is TimelinePauseMarker tpm) { if (tpm.IsActive) { tpm.IsActive = false; playableDirector.Pause(); } } // ------------- }
public void PauseTimeLine() { PlayableDirector a = DirectorGameObject.GetComponent <PlayableDirector>(); if (a != null) { foreach (var item in ListAnimations) { prevSpeed = item.speed; item.speed = 0; } StartCoroutine(WaitAndPrint()); a.Pause(); } }
void HandleTalkingToggle(bool enable) { if (enable) { timelineTalking.Play(timelineTalking.playableAsset, DirectorWrapMode.Loop); ForceToggleValue(toggleFace, true); cameraAnimator.SetFloat("Speed", cameraFaceSpeedMultiplier); cameraAnimator.SetTrigger("Reset"); } else { timelineTalking.Pause(); cameraAnimator.SetFloat("Speed", 1f); } }
public override void Execute(GameObject instigator = null) { switch (mode) { case TimelineControlMode.Play: director.Play(); break; case TimelineControlMode.Stop: director.Stop(); break; case TimelineControlMode.Pause: director.Pause(); break; case TimelineControlMode.Loop: director.extrapolationMode = DirectorWrapMode.Loop; break; case TimelineControlMode.Hold: director.extrapolationMode = DirectorWrapMode.Hold; break; } }
// Update is called once per frame void Update() { if (director.time > 70 && !press) { director.Pause(); floatingText.gameObject.SetActive(true); floatingText1.gameObject.SetActive(true); floatingText2.gameObject.SetActive(true); floatingText3.gameObject.SetActive(true); floatingText4.gameObject.SetActive(true); floatingText5.gameObject.SetActive(true); } if (count == 1) { press = true; director.Resume(); } if (director.time > 90) { fadeManager.Fade(); } }
public override void ProcessFrame(Playable playable, FrameData info, object playerData) { dialogBox = playerData as Image; // 这个地方有变化 if (dialogBox != null) { DialogSystem dialogSys = dialogBox.gameObject.GetComponent <DialogSystem>(); dialogSys.GetTextFromFile(sourceText); dialogBox.gameObject.SetActive(true); /*avatar = GameObject.FindGameObjectWithTag("DialogAvatar").GetComponent<Image>(); * text = GameObject.FindGameObjectWithTag("DialogText").GetComponent<Text>(); * avatar.sprite = avatarSourceImage; * text.text = sourceText;*/ director.Pause(); } }
private void Pause() { PlayableDirector pd = timeline.GetComponent <PlayableDirector>(); AudioSource audioData = GetComponent <AudioSource>(); if (pd != null) { pd.Pause(); audioData.Pause(); pause.SetActive(false); pausedBefore = true; play.SetActive(true); } }
public void Play_Pause() { if (director == null) { return; } if (director.state == PlayState.Playing) { director.Pause(); } else { director.Play(); } }
public void PlayPause(InputAction.CallbackContext cc) { if (cc.performed) { if (!Playing) { director.Play(); //director.Pause(); Playing = true; } else { director.Pause(); Playing = false; } } }
private void StartAnimation(CharacterAnimationInfo animationInfo, Action onComplete = null, Action onCancel = null, bool restart = true, bool async = false) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) string animationName = animationInfo.animationName; string timelineKey = animationInfo.timelineKey; m_animator2D.get_transform().set_localRotation(animationInfo.flipX ? Quaternion.Euler(0f, -135f, 0f) : Quaternion.Euler(0f, 45f, 0f)); direction = animationInfo.direction; ITimelineAssetProvider characterData = m_characterData; if (characterData != null) { TimelineAsset timelineAsset; bool flag = characterData.TryGetTimelineAsset(timelineKey, out timelineAsset); if (flag && null != timelineAsset) { if (timelineAsset != m_playableDirector.get_playableAsset()) { m_playableDirector.Play(timelineAsset); } else { if (restart || !m_animator2D.get_animationName().Equals(animationName)) { m_playableDirector.set_time(0.0); } m_playableDirector.Resume(); } m_hasTimeline = true; } else { if (flag) { Log.Warning("Character named '" + m_characterData.get_name() + "' has a timeline setup for key '" + timelineKey + "' but the actual asset is null.", 323, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\HavreMap\\MapPathfindingActor.cs"); } m_playableDirector.set_time(0.0); m_playableDirector.Pause(); m_hasTimeline = false; } } m_animationCallback.Setup(animationName, restart, onComplete, onCancel); m_animator2D.SetAnimation(animationName, animationInfo.loops, async, restart); m_animationParameters = animationInfo.parameters; }
private void ResetPlayer() { if (checkpointTracker == null) { checkpointTracker = GetComponent <CheckpointTracker>(); } print("Last checkpoint was " + checkpointTracker); GameObject.Find("Player Rig").transform.position = checkpointTracker.lastCP.transform.position; GameObject.Find("Player Rig").transform.rotation = checkpointTracker.lastCP.transform.rotation; if (playableDirector == null) { playableDirector = GameObject.Find("Main Timeline").GetComponent <PlayableDirector>(); } playableDirector.Pause(); playableDirector.time = checkpointTracker.directorTime; playableDirector.Resume(); }
// Called when the state of the playable is set to Play public override void OnBehaviourPlay(Playable playable, FrameData info) { if (!isInit) { thisDirector = GameObject.Find("StageManager").GetComponent <PlayableDirector> (); TalkSet = GameObject.Find("TalkSet"); left = TalkSet.transform.Find("Left").GetComponent <Image> (); right = TalkSet.transform.Find("Right").GetComponent <Image> (); text = TalkSet.transform.Find("Talk").GetComponent <Text> (); if (thisDirector) { thisDirector.Pause(); EventManager.OnTouchBegin.AddListener(GoNextPage); GoNextPage(0); } isInit = true; } }