Exemple #1
0
        private void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.GetComponent <FPSController>() != null)
            {
                if (!hasWon)
                {
                    hasWon = true;

                    backgroundMusicController.PlayMusic(BackgroundMusicController.MusicTypes.win);
                    audioSource.PlayOneShot(winningNewsStory);

                    // Disable any existing enemies
                    for (int i = 0; i < enemiesHolder.transform.childCount; i++)
                    {
                        var child = enemiesHolder.transform.GetChild(i).gameObject;
                        if (child != null)
                        {
                            child.SetActive(false);
                        }
                    }


                    StartCoroutine(FadeToWhite(5.0f));
                }
            }
        }
Exemple #2
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));
            }
        }