public void Rewind() { #if (UNITY_ANDROID && !UNITY_EDITOR) if (mediaPlayer != null) { try { mediaPlayer.Call("seekTo", 0); } catch (Exception e) { Debug.Log("Failed to stop mediaPlayer with message " + e.Message); } } #else if (movieTexture != null) { movieTexture.Stop(); if (audioEmitter != null) { audioEmitter.Stop(); } } #endif }
IEnumerator Kamikaze() { yield return(new WaitForSeconds(KamikazeTime)); if (!isSinking) { GlowThisBitches.enabled = false; TorchEffect.SetActive(false); foreach (var c in GetComponents <Collider>()) { c.enabled = false; } GetComponent <UnityEngine.AI.NavMeshAgent>().enabled = false; GetComponentInChildren <SkinnedMeshRenderer>().enabled = false; GetComponentInChildren <SpriteRenderer>().enabled = false; bombTimerSound.Stop(); ExplosionBunBun.GetComponent <ParticleSystem>().Play(); explosionSound.Play(); playerHealth.AffectHealth(-1); Destroy(gameObject, 3f); } }
private void Update() { if (!videoPlayer.isPlaying) { audioSource.Stop(); particle.Stop(); points.SetActive(true); } }
public void ReturnBackToVideoSelect() { PlayingPlayer.Control.Stop(); particleIceland.Clear(); particleIceland.Stop(); AudioIceland.Stop(); particleNorway.Clear(); particleNorway.Stop(); AudioNorway.Stop(); }
public void EnableBalloonHolderCollisions() { if (m_PlayerAudioSource.isPlaying) { m_PlayerAudioSource.Stop(); } m_PlayerAudioSource.PlayOneShot(m_DitchAudioClip); foreach (GameObject coll in m_BalloonHolders) { coll.GetComponent <BoxCollider>().enabled = true; } }
void Start() { if (breathingAudioSource.isPlaying) { breathingAudioSource.Stop(); } }
void Update() { if (audioSource.time >= 2f) { audioSource.Stop(); } }
public void ResetAlarm() { //Stop alarm audio alarm1.Stop(); alarm2.Stop(); //Play button press sound soundSource.clip = buttonPressSound; soundSource.Play(); //Turn on normal lighting eLight1.SetActive(false); eLight2.SetActive(false); bridgeLight1.SetActive(true); bridgeLight2.SetActive(true); bridgeLight3.SetActive(true); bridgeLight4.SetActive(true); //change materials for each light to match new state eLightMats[1] = eLightDark; bridgeLightMats[1] = bridgeLightLit; buttonMats[1] = buttonDark; buttonMats[0] = buttonLit; eLight1Obj.GetComponent <Renderer>().materials = eLightMats; eLight2Obj.GetComponent <Renderer>().materials = eLightMats; bridgeLight1Obj.GetComponent <Renderer>().materials = bridgeLightMats; bridgeLight2Obj.GetComponent <Renderer>().materials = bridgeLightMats; buttonObj.GetComponent <Renderer>().materials = buttonMats; //Disable emergency door lock bridgeDoor.GetComponent <RedDoor>().Alarm(); }
void Update() { if (!DoorAnimator.IsPlaying()) { if (wasTransitioning) { doorAudioSource.Stop(); doorAudioSource.gainDb = 18.0f; doorAudioSource.PlayOneShot(doorFinishOpenCloseAudioClip); } } if (DoorAnimator.GetCurrentAnimatorStateInfo(0).IsName("DoorClosedStateAnimation")) { wasTransitioning = false; } else { wasTransitioning = DoorAnimator.IsPlaying(); } if (spaceTile != null) { if (IsDoorOpen) { spaceTile.tag = "SpaceTile"; } else { spaceTile.tag = "WallTile"; } } }
IEnumerator SpinForSeconds(float totalTime) { float time = 0f; isWheelSpinning = true; wheelSpinning.Play(); wheelSpinning.pitch = 1f; float percent = (1f - time / totalTime); while (percent > .05f) // 95% done { WheelOfFortune.Rotate(Vector3.forward * percent * SpinForce); wheelSpinning.pitch = percent; yield return(null); time += Time.deltaTime; percent = (1f - time / totalTime); } CarnivalNeedle.OnSpokeHit += CarnivalNeedle_OnSpokeHit; while (isWheelSpinning) { WheelOfFortune.Rotate(Vector3.forward * percent * SpinForce); yield return(null); } CarnivalNeedle.OnSpokeHit -= CarnivalNeedle_OnSpokeHit; wheelSpinning.Stop(); }
void Update() { if (client == null || client.IsServer() || !client.isRunning()) { if (ShouldStopMoving()) { if (audio1 != null) { if (audio1.isPlaying) { audio1.Stop(); } } else { if (audio1 != null) { if (!audio1.isPlaying) { audio1.Play(); } } } } toUpdate++; if (toUpdate == triggerUpdate) { toUpdate = 0; if (client) { client.Send("POS," + transform.position.x + "," + transform.position.y + "," + transform.position.z); } } } }
// Shift to the design section public void StartDesign() { userSFX.clip = selectSFX; userSFX.Play(); ToggleUI(startUI, designUI); designMusic.Play(); startMusic.Stop(); iTween.MoveTo(player, iTween.Hash( "position", designPoint.transform.position, "time", 2, "easetype", "linear" ) ); StartCoroutine("playWalkSFX", 2f); }
private IEnumerator Lerp() { while (transform.position != target.position) { isLerping = true; gazedAt = false; isMoving = true; target.GetComponentInChildren <Renderer> ().material.SetFloat("_Outline", outlineWidthInactive); transform.position = Vector3.MoveTowards(transform.position, target.position, Time.deltaTime * velocity); if (!footStepsAudioSource.isPlaying) { footStepsAudioSource.Play(); } yield return(null); } isMoving = false; if (footStepsAudioSource.isPlaying) { footStepsAudioSource.Stop(); } StopCoroutine(lerp); isLerping = false; target.GetComponent <Renderer> ().material.color = inactiveColor; }
void Update() { if (glassTimer >= 0.0f && glassTimer <= 1.0f) { glassTimer += Time.deltaTime * (glassOn ? 1 : -1); float amount = Mathf.SmoothStep(0, 1, Mathf.Clamp01(glassTimer)); Color windowColor = Color.Lerp(glassDarkColor, glassLightColor, amount); glass.material.SetColor("_EmissionColor", windowColor); } if (lightsOn) { lightsTimer += Time.deltaTime; if (!lightsOnPlayed && lightsTimer > lightsOnDelay) { lightsOnPlayed = true; leftSounds.PlayOneShot(lightsOnLeft); rightSounds.PlayOneShot(lightsOnRight); } if (!powerUpPlayed && lightsTimer > powerUpDelay) { powerUpPlayed = true; leftSounds.PlayOneShot(powerUpLeft); rightSounds.PlayOneShot(powerUpRight); glassTimer = Mathf.Clamp01(glassTimer); glassOn = true; } if (!loopPlayed && lightsTimer > loopDelay) { loopPlayed = true; leftSounds.Play(); rightSounds.Play(); } if (!complete && lightsTimer > completeDelay) { complete = true; if (GreenHouseRoomManager.instance != null) { GreenHouseRoomManager.instance.Complete(); GreenHouseRoomManager.instance.GetVOSequencer().AddEvent("greenhousecomplete"); } } } if (leftSounds.isPlaying) { leftSounds.volume -= Time.deltaTime / 8.0f; rightSounds.volume -= Time.deltaTime / 8.0f; if (leftSounds.volume < 0.05f) { leftSounds.Stop(); rightSounds.Stop(); } } }
public void Play() { if (Audio != null) { if (Audio.isPlaying) { Audio.Stop(); } Audio.Play(); } if (Particle != null) { if (Particle.isPlaying) { Particle.Stop(); } Particle.Play(); } }
void RpcStopSound() { Debug.Log("Inside Rpc Stop Sound"); gvrAudio = gameObject.GetComponent <GvrAudioSource>(); if (gvrAudio.isPlaying) { Debug.Log("Stopping sound"); gvrAudio.Stop(); } }
void Update() { if (!videoPlayer.isPlaying && !isFinished) { if (videoPlayer != null) { if (videoPlayer.time >= 29.5) { //Video has finshed playing! play.SetActive(false); pause.SetActive(false); toggleObject(playAgain); src.Stop(); isFinished = true; } } } }
public void Restart() { videoAudio.Stop(); videoAudio.Play(); videoPlayer.frame = 0; audioSource.Stop(); audioSource.Play(); Button.SetActive(false); finished = true; isPlaying = true; }
//------------------------------------------------------------------------------------------------- private void StopAudio(GvrAudioSource _source, bool _fadeOut = false, Action _crossFadeCallback = null) { if (_fadeOut) { StartCoroutine(FadeOut(_source, _crossFadeCallback)); } else { _source.Stop(); } }
//设置声音播放状态 public void SetAudio(bool isPlay) { if (isPlay) { audioSource.Play(); } else { audioSource.Stop(); } }
//------------------------------------------------------------------------------------------------------------- public void Audio(bool _active) { if (_active) { AudioSource.Play(); } else { AudioSource.Stop(); } }
/// <summary> /// Stops a looping audio clip. /// </summary> public void StopLoop() { if (Source) { Source.Stop(); } else { Debug.LogWarningFormat("Attempting to stop loop on {0}, but the Sound Event Listener " + "has no audio source.", gameObject); } }
public void RestartVideo(){ startGameObject.SetActive (false); menuGameObject.SetActive (true); endVideoGameObject.SetActive (false); finished = false; started = false; videoPlayer.Stop (); videoPlayer.Play (); audioSource.Stop (); audioSource.Play (); endParticleSystem.Stop (); }
//------------------------------------------------------------------------------------------------------------- public void PlayAudio(bool _active) { if (_active) { AudioSourceLeft.Play(); AudioSourceRight.Play(); } else { AudioSourceLeft.Stop(); AudioSourceRight.Stop(); } }
public void LaserOff() { if (shot == true) { shot = false; audioSrc.Stop(); for (int i = 0; i < sourceArr.Length; i++) { Destroy(laserArr[i]); } } }
public static IEnumerator fadeOut(this GvrAudioSource audioSource, float duration) { float startVolume = audioSource.volume; float counter = 0f; while (counter < duration) { audioSource.volume = Mathf.Lerp(startVolume, 0, counter / duration); counter += Time.deltaTime; yield return(new WaitForEndOfFrame()); } audioSource.volume = 0; audioSource.Stop(); }
public void SyncWithInstrumentGroup() { _synchronizeCounter = synchronizeFrameFrequency; if (source.clip != null) { if (parentGroup.loop) { source.time = parentGroup.PlaybackTime % source.clip.length; source.Play(); } else { if (parentGroup.PlaybackTime < source.clip.length) { source.time = Mathf.Clamp(parentGroup.PlaybackTime, 0f, source.clip.length); source.Play(); } else { source.Stop(); } } } }
/*public void CmdStartFire() { * StartFire (); * } * * [Command] * public void CmdStartSmoke() { * StartCoroutine(smokegenerator ()); * }*/ public void StopFire() { if (isServer) { if (gvrAudio.isPlaying) { gvrAudio.Stop(); } fire.GetComponent <FireFlamesScript> ().StopSound(); NetworkServer.Destroy(fire); Destroy(fire); } }
public void StopExplosionSound() { if (!isServer) { return; } gvraudiosource = gameObject.GetComponent <GvrAudioSource>(); if (gvraudiosource.isPlaying) { Debug.Log("Playing explosion sound"); gvraudiosource.Stop(); } Debug.Log("Rpc Stopping Sound"); RpcStopExplosionSound(); }
/// <summary> /// Plays the assigned clip on the specified audio source. /// </summary> public virtual void PlaySound() { if (Source != null && Clip != null) { if (PlayAsOneShot) { Source.PlayOneShot(Clip, VolumeScale); } else { Source.Stop(); Source.clip = Clip; Source.Play(); } } OnPlayed.Invoke(); }