IEnumerator PhantomFlyByRoutine() { isInProgress = true; if (RoomLights != null) { RoomLights.ToggleLights(false); } if (audioSource != null) { audioSource.Play(); } yield return(new WaitForSeconds(delayBetweenSFXAndVFX)); Debug.Log("Headset collided with " + name); PhantomAnimator.SetTrigger("FlyBy"); if (ThunderLights != null && !ThunderLights.IsFlickering) { ThunderLights.FlickerOnce(); } yield return(new WaitForSeconds(lightsOffDuration - delayBetweenSFXAndVFX)); if (RoomLights != null && !ThunderLights.IsFlickering) { RoomLights.ToggleLights(true); RoomLights.FlickerOnce(); } isInProgress = false; }
private void OnTriggerEnter(Collider other) { if (other.name.Contains(headsetColliderContainerName)) { Debug.Log("Headset collided with trigger"); if (RoomLights != null) { RoomLights.FlickerOnce(); } if (audioSource != null && !audioSource.isPlaying) { audioSource.Play(); } } }
private void OnTriggerEnter(Collider other) { if (other.name.Contains(headsetColliderContainerName) && !BlockPuzzleScript.isPuzzleSolved) { Debug.Log("Headset collided with trigger"); if (RoomLights != null) { RoomLights.FlickerOnce(); } if (audioSource != null && audioClipsToPlay.Count > 0 && !audioSource.isPlaying) { audioSource.PlayOneShot(audioClipsToPlay[Mathf.RoundToInt(Random.Range(0, audioClipsToPlay.Count))]); //audioSource.Play(); } } }