IEnumerator TriggerNightmareWithDelay(float triggerDelay) { yield return(new WaitForSeconds(triggerDelay)); backgroundMusicController.PlayMusic(BackgroundMusicController.MusicTypes.nightmare); nightmareController.SwitchToNightmare(); if (spawnsEnemy) { enemy.SetActive(true); } }
IEnumerator Level1IntroScript() { // Disable display and control and start intro audio fPSController.InputControl(false); fPSController.CameraTarget(animatedTarget); GameObject.Find("[UI]/Canvas2/BlackoutPanel").GetComponent <Image>().color = new Color(0, 0, 0, 255); //Wait a tiny bit to let things get out of start yield return(new WaitForSeconds(0.1f)); // Disable first clue //firstClue.SetActive(false); // Line 7-19 playSeriesOfAudioClips.PlaySeries(); float clipLength = playSeriesOfAudioClips.GetClipLength(0); Debug.Log(Time.time + " waiting for " + clipLength * percentAudioBeforemovement); yield return(new WaitForSeconds(clipLength * percentAudioBeforemovement)); postProcessingObject.GetComponent <constantDOFChanger>().SetDOF(true, 0); StartCoroutine(SlowClearBlackout(clipLength * (1 - percentAudioBeforemovement) / 2)); viewAnimator.SetTrigger("PlayView"); Debug.Log(Time.time + " waiting for " + clipLength * (1 - percentAudioBeforemovement)); yield return(new WaitForSeconds(clipLength * (1 - percentAudioBeforemovement))); postProcessingObject.GetComponent <constantDOFChanger>().SetDOF(false, 0); // Disable input until 2nd clip is done // Line 8 clipLength = playSeriesOfAudioClips.GetClipLength(1); yield return(new WaitForSeconds(clipLength)); // Re-enable display and control fPSController.ResetMouseView(); fPSController.InputControl(true); // Line 9 clipLength = playSeriesOfAudioClips.GetClipLength(2); yield return(new WaitForSeconds(clipLength)); var flickerNightmareTimeOffset = 0.5f; // Line 10 clipLength = playSeriesOfAudioClips.GetClipLength(3) - flickerNightmareTimeOffset; yield return(new WaitForSeconds(clipLength)); // Line 11-13 (time to flicker lights) clipLength = playSeriesOfAudioClips.GetClipLength(4) + playSeriesOfAudioClips.GetClipLength(5) + playSeriesOfAudioClips.GetClipLength(6); //Full Nightmare here nightmareController.SwitchToNightmare(clipLength); // Line 14-16 clipLength += playSeriesOfAudioClips.GetClipLength(7) + playSeriesOfAudioClips.GetClipLength(8) + playSeriesOfAudioClips.GetClipLength(9); yield return(new WaitForSeconds(clipLength)); //Normal again here nightmareController.SwitchToDream(); // Line 17-20 clipLength = playSeriesOfAudioClips.GetClipLength(10) + playSeriesOfAudioClips.GetClipLength(11) + playSeriesOfAudioClips.GetClipLength(12) + +playSeriesOfAudioClips.GetClipLength(13) + flickerNightmareTimeOffset; yield return(new WaitForSeconds(clipLength)); firstClue.GetComponent <ClueController>().enableClue(); }