// Start is called before the first frame update
 void Start()
 {
     scareAudioSource       = GetComponent <AudioSource>();
     flashingLight          = GetComponentInChildren <Light>();
     playSeriesOfAudioClips = GetComponent <PlaySeriesOfAudioClips>();
     flashingLight.enabled  = false;
 }
示例#2
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);
        }
 // Start is called before the first frame update
 void Start()
 {
     Time.timeScale         = 1;
     audioSource            = GetComponent <AudioSource>();
     fPSController          = GetComponent <FPSController>();
     playSeriesOfAudioClips = GetComponent <PlaySeriesOfAudioClips>();
     nightmareController    = GameObject.Find("NightmareController").GetComponent <NightmareController>();
     if (!skipIntro)
     {
         StartCoroutine(Level1IntroScript());
     }
     else
     {
         firstClue.GetComponent <ClueController>().enableClue();
     }
 }
        public void Death()
        {
            //Black screen

            if (Time.time > canDieTime)
            {
                canDieTime = Time.time + minTimeToDie;
                //GameObject.Find("[UI]/Canvas2/BlackoutPanel").GetComponent<Image>().color = new Color(0, 0, 0, 255);
                GetComponent <FPSController>().InputControl(false);

                //Play new scream
                if (deathScreams.Length > 1)
                {
                    int previousIndex = deathIndex;
                    while (deathIndex == previousIndex)
                    {
                        deathIndex = Random.Range(0, deathScreams.Length - 1);
                    }
                }
                else
                {
                    deathIndex = 0;
                }

                // Play new spawn audio
                if (spawnTalks.Length > 1)
                {
                    int previousIndex = talkIndex;
                    while (talkIndex == previousIndex)
                    {
                        talkIndex = Random.Range(0, spawnTalks.Length - 1);
                    }
                }
                else
                {
                    talkIndex = 0;
                }

                PlaySeriesOfAudioClips.RestartAll(deathScreams[deathIndex].length + timeBeforeSceenBlack * 2 + spawnTalks[talkIndex].length + 1.0f);

                StartCoroutine(DeathCleanup());
            }
        }
        void ResumeButtonOnClick()
        {
            // Disable this menu view and re-enable player
            if (fPSController.cursorLockedMode == pauseCursorLockState)
            {
                fPSController.cursorLockedMode = previousCursorLockState;
            }
            Cursor.lockState = previousCursorLockState;
            // Hide cursor when locking
            if (Cursor.visible == pauseCursorVisible)
            {
                Cursor.visible = previousCursorVisible;
            }


            //Enable panel views
            GameObject.Find("[UI]/Canvas/PausePanel").GetComponent <Image>().color = initialColorOff;

            //Disable all the children as well
            for (int i = 0; i < transform.childCount; i++)
            {
                var child = transform.GetChild(i).gameObject;
                if (child != null)
                {
                    child.SetActive(false);
                }
            }

            // Re-enable player control
            if (fPSController.enableInput == pauseFPSInputEnabled)
            {
                fPSController.InputControl(previousFPSInputEnabled);
            }
            //Re-enable scene time
            if (Time.timeScale == pauseTimeScale)
            {
                Time.timeScale = previousTimeScale;
            }

            PlaySeriesOfAudioClips.UnpauseAll();
            isPaused = false;
        }
        public void PauseGame()
        {
            if (!isPaused)
            {
                isPaused = true;
                previousCursorLockState = Cursor.lockState;
                previousCursorVisible   = Cursor.visible;
                previousFPSInputEnabled = fPSController.enableInput;
                previousTimeScale       = Time.timeScale;

                pauseCursorLockState = CursorLockMode.None;
                pauseCursorVisible   = true;
                pauseFPSInputEnabled = false;
                pauseTimeScale       = 0;

                // Give mouse back to user
                Cursor.lockState = fPSController.cursorLockedMode = pauseCursorLockState;
                Cursor.visible   = pauseCursorVisible;

                // Disable player
                fPSController.InputControl(pauseFPSInputEnabled);
                //disable scene time
                Time.timeScale = pauseTimeScale;

                //Enable panel views
                GameObject.Find("[UI]/Canvas/PausePanel").GetComponent <Image>().color = initialColor;

                // Show all the panel children
                for (int i = 0; i < transform.childCount; i++)
                {
                    var child = transform.GetChild(i).gameObject;
                    if (child != null)
                    {
                        child.SetActive(true);
                    }
                }

                PlaySeriesOfAudioClips.PauseAll();
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     Time.timeScale         = 1;
     playSeriesOfAudioClips = GetComponent <PlaySeriesOfAudioClips>();
     StartCoroutine(DoctorOfficeIntro());
 }