public void Update() { #if UNITY_EDITOR if (Input.GetKeyDown(KeyCode.P)) { m_playableDirector?.Stop(); } #endif }
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; } }
private IEnumerator PlayActionAnimation(float duration) { if (idleAnimation != null) { idleAnimation.Stop(); actionAnimation.gameObject.SetActive(true); yield return(new WaitForSeconds(duration)); idleAnimation.Play(); actionAnimation.gameObject.SetActive(false); } End(); }
private void Update() { if (Input.GetButtonDown("Fire1")) { gunAnimation.Play(); } else if (Input.GetButtonUp("Fire1")) { gunAnimation.Stop(); } if (Input.GetButton("Fire1")) { mNormalShots.Emit(1); } }
void OnTriggerExit(Collider c) { if (c.gameObject.tag == "Player") { Timeline_O.SetActive(false); if (timeline) { timeline.Stop(); } else { //Nothing } } }
public void chooseOptionTwo() { print("2222"); // first choice if (state == 5) { state += 1; startingTimeline.Stop(); decision1_2.Play(); optionUI.SetActive(false); _changeBar.productionVal += 25; _changeBar.suspicionVal += 30; productionSlider.value = _changeBar.productionVal / 100; suspicionSlider.value = _changeBar.suspicionVal / 100; } }
// Update is called once per frame void Update() { if (director.state != PlayState.Playing && !fix) { fix = true; playerAnimator.runtimeAnimatorController = playerAnim; } if (Input.GetKeyDown(KeyCode.S)) { director.Stop(); mainCamera.transform.localPosition = new Vector3(0, 5, -10); } }
/// <summary> 停止. </summary> public void Stop() { Initialize(); if (playingDisposable != null) { playingDisposable.Dispose(); playingDisposable = null; } timeKeeper = 0; playableDirector.Stop(); state = State.Finish; }
IEnumerator PlayCutSceneBear() //Level 1 { Pause(); level_timestamp_1.SetValue(new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()); cutsceneBear.transform.GetChild(0).gameObject.SetActive(true); cutsceneBear.Play(); Debug.Log((float)cutsceneBear.duration); yield return(new WaitForSeconds((float)cutsceneBear.duration)); currentLevel.Variable.SetValue(1); cutsceneBear.Stop(); cutsceneBear.transform.GetChild(0).gameObject.SetActive(false); dialogUI.SetDialog("GM", "<size=150%>Oh no! </size> bear is awake <color=blue> You need to run!!!</color>"); dialogUI.SetButtonEvent(Resume); }
private void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (currentCinematic != null && currentCinematic.state == PlayState.Playing) { currentCinematic.time = currentCinematic.duration; currentCinematic.Evaluate(); currentCinematic.Stop(); } else if (itemFlyIn != null && itemFlyIn.IsInProgress()) { itemFlyIn.CancelFlyIn(); } } }
public void OnLevelFailed() { if (multiplayerSessionManager != null && multiplayerSessionManager.isConnected && !_lastStandingCheckActive) { StartCoroutine(CheckLastStanding()); } if (LevelFailedEffect == null) { LevelFailedEffect = Resources.FindObjectsOfTypeAll <LevelFailedTextEffect>().FirstOrDefault(); } //Logger.Trace("BailOutController ShowLevelFailed()"); //BS_Utils.Gameplay.ScoreSubmission.DisableSubmission(Plugin.PluginName); Don't need this here UpdateFailText($"Bailed Out {numFails} time{(numFails != 1 ? "s" : "")}"); try { if (!Configuration.instance.RepeatFailEffect && numFails > 1) { return; // Don't want to repeatedly show fail effect, stop here. } //Logger.Debug("Showing fail effects"); if (!isHiding && Configuration.instance.ShowFailEffect && LevelFailedEffect != null) { LevelFailedEffect.ShowEffect(); if (Configuration.instance.FailEffectDuration > 0) { StartCoroutine(hideLevelFailed()); } else { isHiding = true; // Fail text never hides, so don't try to keep showing it } } if (Configuration.instance.ShowFailAnimation && LevelFailedEnergyBarAnimation != null) { // Cancel any in-progress fail animation before playing a new animation, to prevent missing an animation when failing multiple times in quick succession. LevelFailedEnergyBarAnimation.Stop(); LevelFailedEnergyBarAnimation.Play(); } } catch (Exception ex) { Logger.log.Error($"Exception trying to show the fail Effects: {ex.Message}"); Logger.log.Debug(ex); } }
// When this game object intersects a collider with 'is trigger' checked, // store a reference to that collider in a variable named 'other'.. void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Reset" || other.gameObject.CompareTag("Pick Up")) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; print("raawas"); gameObject.transform.position = originalPos; StopTriumph(); PlayImpact(); timeline.Stop(); Start(); } else if (other.gameObject.tag == "WinTrigger") { if (hasPlayedTriumph == false) { playTriumph(); print("triggerwotrks"); timeline.Play(); hasPlayedTriumph = true; } } else if (other.gameObject.tag == "Win") { print("daalbhaat"); //winText.gameObject.SetActive(true); //winText.text = ""; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.isKinematic = true; winCanvas.SetActive(true); playerAudio.Stop(); playerAudio.PlayOneShot(winSound, 0.5f); gameUIcanvas.SetActive(false); pauseCanvas.SetActive(false); } else if (other.gameObject.tag == "bounce") { if (rb.velocity.y < 0.001) { print(Mathf.Abs(rb.velocity.magnitude)); float intensity = (Mathf.Abs(rb.velocity.magnitude) * 0.1f); playerAudio.PlayOneShot(bounce, intensity); } } }
// Update is called once per frame void Update() { if (active) { timeLineDuration += Time.deltaTime; } if (timeLineDuration > 15.5f && lul) { active = false; lul = false; } if (timeLineDuration > 14.5f && lul) { playableDirector.Stop(); } }
public void Moved(bool mate) { StartAnimation(2); state = States.PostMove; if (mate) { MateUi.SetActive(true); MateTimeline.Stop(); MateTimeline.Play(); } else { DrawUi.SetActive(true); DrawTimeline.Stop(); DrawTimeline.Play(); } }
void OnPlayableDirectorStopped(PlayableDirector aDirector) { if (director == aDirector) { director.Stop(); played = true; //Configura la culling Mask y activa al player if (FindObjectOfType <ManageCameraCullingMask>().cm == CameraCullingMask.EVERYTHING) { FindObjectOfType <ManageCameraCullingMask>().ChangeCullingMask(); } FindObjectOfType <GeneralSoundManager>().ManageGeneralSound(); FindObjectOfType <PlayerController>().SetIsLocked(false); FindObjectOfType <Mount>().SetIsLocked(false); FindObjectOfType <PlayerController>().EnableOrDisableCharacterController(true); } }
private IEnumerator Timer() { director.played -= TimelinePlayed; float t = 0; float d = (float)director.playableAsset.duration; WaitForEndOfFrame wait = new WaitForEndOfFrame(); while (t < d) { t += Time.deltaTime; yield return(wait); } director.Stop(); player.transform.GetChild(0).gameObject.SetActive(true); TimelineCamera.SetActive(false); player.ChangeMoveRotaState(true); }
private IEnumerator StartCutsceneBeforeCountdown() { LogUtil.PrintInfo(gameObject, this.GetType(), "Starting game..."); playableStartGame.gameObject.SetActive(true); playableStartGame.enabled = true; playableStartGame.Play(); yield return(new WaitForSeconds((float)playableStartGame.duration)); playableStartGame.Stop(); playableStartGame.enabled = false; playableStartGame.gameObject.SetActive(false); model.StartGameCountdown(); Destroy(this); }
void Update() { if (!hasStarted) { StartCoroutine(WaitForCutScene()); hasStarted = true; } else if (hasFinished) { if (Input.GetButton("Jump") && !quit) { _timeLine.Stop(); FinishCutScene(); quit = true; } } }
//int autoCancelDelay; public void Stop(bool canAutoCancel) { //Cancel when hit by opponent attack attackPlayer.Stop(); if (canAutoCancel) { if (endLagFrameCount < autoCancelWindow) { //autoCancelDelay = 0; targetLag = autoCancelLag; } } else { Ongoing = false; } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { //Si no estamos en el nuevo punto de vista, realizamos la transición. if (newCameraPoint.state != PlayState.Playing || newCameraPoint.state == PlayState.Paused) { originalCamera.Stop(); newCameraPoint.Play(); } else //Si por otro lado, estamos ya en el nuevo punto de vista, eso quiere decir que estamos saliendo del area de cámara designada, { //Con lo cual volvemos al punto de vista original, el anterior a la transicion. newCameraPoint.Stop(); originalCamera.Play(); } } }
// Update is called once per frame void Update() { double t = director.time - Time.deltaTime; if (t < 0) { t = 0; } director.time = t; director.Evaluate(); if (t == 0) { director.Stop(); Destroy(this); } }
public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus) { if (newStatus == TrackableBehaviour.Status.DETECTED || newStatus == TrackableBehaviour.Status.TRACKED || newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) { timeline.Play(); audio.Play(); Debug.Log("Audio begin"); } else { timeline.Stop(); audio.Stop(); Debug.Log("Audio stop"); } }
public void ShowRandomKey() { if (keyUI == null) { return; } if (!isDisplayingKey) { ShowKeyObject(true); DisplayRandomKey(); isDisplayingKey = true; } else //player lost { ShowKeyObject(false); gameDirector.Stop(); } }
IEnumerator CorrectRoutine() { raycaster.enabled = false; correctDirector.Stop(); correctDirector.Play(); yield return(new WaitForSeconds((float)correctDirector.playableAsset.duration)); stage++; if (stage == 5) { result.Show(); } else { RandomProblem(); raycaster.enabled = true; } }
protected override IEnumerator Event_Tieup() { if (Ani != null) { Ani.enabled = false; // 여기도 초기화 해주는 코드 필요? Ani.Stop(); } if (Timeline != null) { Timeline.time = 0; Timeline.Stop(); Timeline.enabled = false; } Debug.Log("Timline finish"); yield return(StartCoroutine(Event_Finish())); }
public void HandleState(bool wantActive) { if (isPlaying) { return; } isPlaying = true; if (wantActive) { directorOff.Stop(); directorOn.Play(); } else { directorOn.Stop(); directorOff.Play(); } }
// Update is called once per frame void Update() { if (pd != null && pd.state != PlayState.Playing) { pd.Stop(); //restore the position of the camera before cutscene Camera.main.transform.localPosition = previousPosition.localPosition; Camera.main.transform.localRotation = previousPosition.localRotation; gameObject.SetActive(false); //we must disable this object in order of //avoid calling this update again. This component also must be attached } //not the best way, but the fastest for this demo //we should have a timeline manager, and custom timeline script with skipable behaviours. if (Input.GetKeyDown("s") && !Skiped) { Skiped = true; pd.time = 60.2f; } }
public override void OnSignalRecieved(eObject source, string[] signal) { base.OnSignalRecieved(source, signal); switch (signal[0]) { case "backToPlayer": if (m_camState != CameraState.CameraOnPlayer) { m_camState = CameraState.CameraOnPlayer; m_camera.transform.localPosition = localPosTarget; m_camera.transform.localRotation = localRotTarget; if (m_UIController.IsPlayerUnfreezeable()) { playerUnfreezed = true; slime.GetComponent <Slime>().UnfreezePlayer(); } } break; case "stopDirector": if (m_director) { m_director.Stop(); m_director = null; } Vector3 tmppos = m_camera.transform.position; Quaternion tmprot = m_camera.transform.rotation; m_camState = CameraState.CameraOnOther; transform.position = slime.transform.position + 1.7f * Vector3.up; transform.rotation = slime.transform.rotation; m_camera.transform.position = tmppos; m_camera.transform.rotation = tmprot; break; } }
void Restart(Vector3 startPositionVector) { //teleport to start position if (characterController) { characterController.transform.position = startPositionVector; characterController.transform.localRotation = Quaternion.Euler(0.0f, -180.0f, 0.0f); characterController.transform.localScale = new Vector3(macroScale, macroScale, macroScale); } currentMarkerLevel = 0; currentTimer = 1000000; hasEnded = false; EndTimeline.Stop(); hasStarted = false; BeginTimeline.Stop(); KingelezCityRoot.SetActive(false); KingelezCityExteriorRoot.SetActive(false); //hide all plates endPlate.SetActive(false); //AllianzStartPlate.SetActive(false); AllianzStartPlate2.SetActive(false); AllianzEndPlate.SetActive(false); //show start plate if (startPlate != null) { startPlate.SetActive(true); } if (startPlateScript != null) { startPlateScript.gameObject.SetActive(true); startPlateScript.enabled = true; startPlateScript.InitScale(); } }
private void reversing(PlayableDirector t) { //Debug.Log("Revinding: " + t.name); rewindTimer = t.time - Time.deltaTime; //Debug.Log(rewindTimer); if (rewindTimer < 0) { rewindTimer = 0; } t.time = rewindTimer; t.Evaluate(); if (rewindTimer == 0) { t.Stop(); playFocusReverse = false; Debug.Log("Finished revinding"); } }