예제 #1
0
        // Start is called before the first frame update
        void Start()
        {
            nightmareController       = GameObject.Find("NightmareController").GetComponent <NightmareController>();
            fPSController             = GameObject.Find("Player").GetComponent <FPSController>();
            flashlight                = GameObject.Find("Player/MainCamera/Flashlight").GetComponent <FlashlightController>();
            spectreVisionController   = GameObject.Find("Player/ClueCamera/SpectrePopup").GetComponent <SpectreVisionController>();
            backgroundMusicController = GameObject.Find("Player/BGMusic").GetComponent <BackgroundMusicController>();
            clueCameraTracker         = GameObject.Find("Player/ClueCamera").GetComponent <CameraTracker>();
            audioSource               = GetComponent <AudioSource>();
            playSeriesOfAudioClips    = GetComponent <PlaySeriesOfAudioClips>();
            //if (spawnsEnemy)
            //    enemy.SetActive(false);

            nightmareTriggerDelay = 0.0f;
            for (int i = 0; i < audioClipsBeforeTrigger; i++)
            {
                nightmareTriggerDelay += playSeriesOfAudioClips.GetClipLength(i);
            }
            if (nightmareTriggerDelay != 0)
            {
                Debug.Log("Nightmare triggers with " + nightmareTriggerDelay + " s delay.");
            }

            //Disable final scene trigger at startup
            if (enablesClue)
            {
                StartCoroutine(DisableNextClue());
            }


            //Debug.Log("Started up " + gameObject.name);
        }
예제 #2
0
        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();
        }