IEnumerator PlaySuccessAndDestroy(GameObject item) { MusicPicker musicPicker = FindObjectOfType <MusicPicker> (); AudioClip successClip = musicPicker.successClip; musicPicker.PlayClip(successClip); inventory.reticleOnObject = false; yield return(new WaitForSeconds(successClip.length - 0.1f)); musicPicker.StopClip(); item.SetActive(true); Destroy(gameObject); }
private IEnumerator Stressed() { leftCamera.enabled = true; rightCamera.enabled = true; // Play clips to show player he needs to drink or eat AudioClip unwellClip = musicPicker.unwellClip; musicPicker.PlayClip(unwellClip); yield return(new WaitForSeconds(unwellClip.length - 0.1f)); musicPicker.StopClip(); musicPicker.PlayStressClip(); musicPicker.stressed++; }
public void EndTheGame(string endLevelToLoad, float waitTime) { // Fade to black at the end of the game GameObject reticle = GameObject.Find("GvrReticlePointer"); reticle.SetActive(false); resourceMining.stopInteracting = true; StartCoroutine(FadeOut()); // Play endgame clip MusicPicker musicPicker = FindObjectOfType <MusicPicker> (); if (endLevelToLoad == "EndGame") { endMusic = musicPicker.endMusic; } else { endMusic = musicPicker.deathClip; } musicPicker.PlayClip(endMusic); // Wait for waitTime seconds, then call endgame scene StartCoroutine(CallEndGameGUI(endLevelToLoad, waitTime)); }