IEnumerator FlashingLightsAndDoor()
        {
            playSeriesOfAudioClips.PlaySeries();
            StartCoroutine(FlashLights());
            yield return(new WaitForSeconds(playSeriesOfAudioClips.GetClipsLength()));

            livingRoomDoor.GetComponent <DoorController>().EnableDoor();
            livingRoomDoor.GetComponent <DoorController>().Use();
        }
Ejemplo n.º 2
0
        IEnumerator DoctorOfficeIntro()
        {
            yield return(new WaitForSeconds(0.1f));

            playSeriesOfAudioClips.PlaySeries();

            float clipsLength = playSeriesOfAudioClips.GetClipsLength();

            yield return(new WaitForSeconds(clipsLength));

            SceneManager.LoadScene(nextScene);
        }
Ejemplo n.º 3
0
        public void Use()
        {
            // In case we want something you can use more than once
            if (isEnabled && (useCount < uses) && (Time.time > timeAvailable))
            {
                timeAvailable = Time.time + timeDisabledAfterUse;
                Debug.Log("using item " + gameObject);
                useCount++;
                if (playSeriesOfAudioClips != null)
                {
                    playSeriesOfAudioClips.PlaySeries();
                    lengthOfAudio     = playSeriesOfAudioClips.GetClipsLength();
                    timeDoneWithAudio = Time.time + lengthOfAudio;
                    //Debug.Log("Playing series");
                }
                else if (useSound != null)
                {
                    audioSource.PlayOneShot(useSound);
                }
                else
                {
                    Debug.Log("No audio");
                }

                // This is the last use
                if (useCount == uses)
                {
                    GetComponent <FlashingIndicator>().DisableFlasher();
                }

                if (triggersNightmareMode)
                {
                    StartCoroutine(TriggerNightmareWithDelay(nightmareTriggerDelay));
                }

                if (triggersDreamMode)
                {
                    backgroundMusicController.PlayMusic(BackgroundMusicController.MusicTypes.normal);
                    nightmareController.SwitchToDream();
                    blockage.SetActive(false);
                    if (spawnsEnemy)
                    {
                        enemy.SetActive(false);
                    }
                }


                // Changing to respawn even at nightmare trigger, because last good location could be harder to get back to the new good location
                // This could end up resulting in repeated deaths though...
                if (triggersNewSpawnPoint)
                {
                    fPSController.RecordNewSpawnPoint();
                }


                originalPosition = transform.position;
                originalScale    = transform.localScale;
                originalRotation = transform.rotation;
                ViewClue();

                StartCoroutine(DelayClueEnable(timeDoneWithAudio));
            }
        }