// Update is called once per frame void Update() { //Game Over Screen and its options if (player.GetComponent <PlayerControl>().isAlive == false) { //Activates game over screen when player is not alive player.GetComponent <PlayerControl>().enabled = false; //Disables player control script if (timer > 0) { timer -= Time.deltaTime; } if (timer <= 0 && gameOver == false) { audioHandler.StopMusic(); gameOver = true; StartCoroutine(fadeToBlack()); //play music clip #2 (game over music) audioHandler.LoopMusic(false); //play death crunch sound audioHandler.PlaySound(0); //start ending music StartCoroutine("GameOverMusic"); //audioHandler.PlayMusic(2); gameOverPanel.SetActive(true); //Time.timeScale = 0f; } } }
void Start() { // Unfreezes time in case somebody forgets to do it (thanks pause screen) Time.timeScale = 1f; //create or reset the playerpref for level jumping PlayerPrefs.SetInt("NextLevel", 3); // Makes sure the sprites appear correct const int scrnHeight = 720; const int ppu = 100; FindObjectOfType <Camera>().orthographicSize = (scrnHeight / 2.0f) / ppu; //play title music audioHandler.LoopMusic(true); //music 0 is Lullaby Waltz (title music) audioHandler.PlayMusic(0); // The settings management code are in their respective screens. // These screens start out inactive; their initialization needs to be manually called. // Awake() and Start() won't be called if an object starts out inactive. scrnBrightness.InitSettings(); scrnAudio.InitSettings(); StartCoroutine(_FadeIn()); }
void Start() { skipButton.gameObject.SetActive(false); audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); audioHandler.LoopMusic(false); //play credits music audioHandler.PlayMusic(2); StartCoroutine(JumpToStart()); }
void Start() { skipButton.gameObject.SetActive(false); audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); audioHandler.LoopMusic(false); //play credits music audioHandler.PlayMusic(2); StartCoroutine(JumpToStart()); }
//The cutsccene IEnumerator _Cutscene() { pause.busy = true; playerScript.normalSpeed = 0f; audioHandler.LoopMusic(false); audioHandler.PlayMusic(3); yield return(new WaitForSeconds(0.5f)); // Lock the camera once it finishes positioning itself cam.GetComponent <CameraFollowScript> ().enabled = false; yield return(new WaitForSeconds(1)); // Pan camera to left until it hits the wall while (cam.transform.position.x > wallMargin) { cam.transform.position += new Vector3(-0.2f, 0, 0); yield return(null); } yield return(new WaitForSeconds(1)); // move the hunter hunterEnemy.SetActive(true); yield return(new WaitForSeconds(1.5f)); // pan back to player while (cam.transform.position.x < player.transform.position.x) { cam.transform.position += new Vector3(0.4f, 0, 0); yield return(null); } cam.GetComponent <CameraFollowScript> ().enabled = true; //prevent player from moving until end of cutscene hunterEnemy.GetComponent <Hunter>().SetSpeed(); playerScript.defaultSpeed = defaultSpeedTemp; playerScript.normalSpeed = playerScript.defaultSpeed; pause.busy = false; //doorScript.enabled = true; yield return(null); }
IEnumerator _Cutscene() { //how long to wait until cutscene begins if (Application.loadedLevelName == "Tutorial Stage") { yield return(new WaitForSeconds(1.5f)); audioHandler.PlayVoice("dialogue_goodnight_1"); yield return(new WaitForSeconds(3f)); } else { yield return(new WaitForSeconds(1.5f)); if (Application.loadedLevelName == "Ending Level") { //do nothing // audioHandler.PlayVoice(17); } else { audioHandler.PlayVoice("dialogue_goodnightwhisper_1"); } yield return(new WaitForSeconds(3f)); } // Lock the camera once it finishes positioning itself cam.GetComponent <CameraFollowScript> ().enabled = false; audioHandler.LoopMusic(false); audioHandler.PlayMusic(3); yield return(new WaitForSeconds(1)); // Pan camera to left until it hits the wall while (cam.transform.position.x > wallMargin) { cam.transform.position += new Vector3(-0.2f, 0, 0); yield return(null); } yield return(new WaitForSeconds(1)); // move the hunter hunterEnemy.SetActive(true); yield return(new WaitForSeconds(1.5f)); // pan back to player while (cam.transform.position.x < player.transform.position.x) { cam.transform.position += new Vector3(0.4f, 0, 0); yield return(null); } cam.GetComponent <CameraFollowScript> ().enabled = true; //prevent player from moving until end of cutscene playerScript.normalSpeed = playerScript.defaultSpeed; pause.busy = false; audioHandler.LoopMusic(true); audioHandler.PlayMusic(5); //yield return new WaitForSeconds(10f); // hunterEnemy.SetActive(false); yield return(null); }