private IEnumerator movementTransition() // fade to black and unfade for transition { sceneFader.StartFade(); yield return(new WaitForSeconds(1)); windParticles.SetActive(!windParticles.activeSelf); isFlying = !isFlying; if (isFlying == false) // fade out sound { float startVolume = windSound.volume; while (windSound.volume > 0) { windSound.volume -= startVolume * Time.deltaTime / 1; yield return(null); } } else // fade in sound { while (windSound.volume < 1) { windSound.volume += 1 * Time.deltaTime / 1; yield return(null); } } }
private void Update() { if (Vector3.Distance(gameObject.transform.position, headset.transform.position) <= requiredDistance) { sceneFader.StartFade(); } }
private IEnumerator BackToHive() // fade to black and unfade for transition { sceneFader.StartFade(); yield return(new WaitForSeconds(1)); progress = 1.0f; player.transform.position = startLocation; StartCoroutine(updateHealth()); }
private IEnumerator MoveToScene() // fade to black and unfade for transition { sceneFader.StartFade(); yield return(new WaitForSeconds(1)); buttonXHighlight.SetActive(false); gameObject.GetComponent <MeshRenderer>().enabled = false; beeLeftControls.SetActive(true); SceneManager.LoadScene("BeeScene"); }
void Update() { // Get the distance between the headset and the goggles float dist = Vector3.Distance(gameObject.transform.position, centerEyeAnchor.transform.position); // If the distance is within the threshold, and a fade has not yet been initialized, initialize a fade if (dist <= threshold && !sceneFader.IsFading()) { sceneFader.StartFade(); } }