Beispiel #1
0
        private IEnumerator PulseLight()
        {
            isLit = true;
            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            if (fixedOn)
            {
                lampTrigger.OnLit();
            }
            else
            {
                isLit = false;
                OnProximityFailed();
            }

            yield return(StartCoroutine(UtilFunctions.LerpCoroutine(LightSetting, 0, PULSE_PROPORTION, PULSE_TIME)));

            if (fixedOn)
            {
                yield return(StartCoroutine(UtilFunctions.LerpCoroutine(LightSetting, PULSE_PROPORTION, 1, PULSE_TIME)));
            }
            else
            {
                yield return(StartCoroutine(UtilFunctions.LerpCoroutine(LightSetting, PULSE_PROPORTION, 0, PULSE_TIME)));
            }
        }
Beispiel #2
0
        // Used for turning from on state to off
        public virtual void LightOff()
        {
            isLit = false;

            float start = (currentIntensity - MIN_INTENSITY) / (MAX_INTENSITY - MIN_INTENSITY);

            StartCoroutine(UtilFunctions.LerpCoroutine(LightSetting, start, 0, LIGHT_OFF_TIME));
        }
        private void Start()
        {
            audioSource        = GetComponent <AudioSource>();
            audioSource.volume = 0;
            audioSource.loop   = true;

            crossAudio      = this.gameObject.AddComponent <AudioSource>();
            crossAudio.loop = true;

            StartCoroutine(UtilFunctions.LerpCoroutine(FadeTheme, 0, 1, FADE_IN_TIME));
        }
        public IEnumerator CrossFadeOutMix(float fadeTime)
        {
            yield return(StartCoroutine(UtilFunctions.LerpCoroutine(CrossFade, .5f, 1f, fadeTime)));

            mainMaxAudio = mainTrueMax;
            if (mainMaxAudio != audioSource.volume)
            {
                float start = audioSource.volume / mainMaxAudio;
                float fade  = FADE_IN_TIME * (1 - start);
                yield return(StartCoroutine(UtilFunctions.LerpCoroutine(FadeTheme, start, 1, fade)));
            }
        }
        public IEnumerator CrossFadeInMix(AudioClip audioClip, float fadeTime, float newAudioMaxVolume)
        {
            crossAudio.volume = 0;
            crossAudio.clip   = audioClip;
            crossAudio.Play();

            mainTrueMax   = mainMaxAudio;
            mainMaxAudio  = audioSource.volume;
            crossMaxAudio = newAudioMaxVolume;

            yield return(StartCoroutine(UtilFunctions.LerpCoroutine(CrossFade, 1, .5f, fadeTime)));
        }
Beispiel #6
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (other.gameObject.tag == "Player")
     {
         lantern.LightableLampsUpdate(this, false);
         if (lampType == LampType.PROXIMITY && !fixedOn && isLit)
         {
             isLit = false;
             StartCoroutine(UtilFunctions.LerpCoroutine(LightSetting, 1, 0, DELIGHT_TIME));
         }
     }
 }
 public override void RunEvent()
 {
     if (!triggered)
     {
         triggered = true;
         int[] values = { 0, 1 };
         if (!fadeInText)
         {
             Array.Reverse(values);
         }
         StartCoroutine(UtilFunctions.LerpCoroutine(FadeText, values[0], values[1], fadeTime));
     }
 }
Beispiel #8
0
        private void SetRespawnColor(bool state)
        {
            if (!hiddenSpawn)
            {
                int[] values = { 0, 1 };
                if (!state)
                {
                    Array.Reverse(values);
                }

                StartCoroutine(UtilFunctions.LerpCoroutine(ColorChange, values[0], values[1], COLOR_CHANGE_TIME));
            }
        }
        private IEnumerator TextChanges()
        {
            foreach (string message in messages)
            {
                currentMessage = GenerateText(message);

                StartCoroutine(UtilFunctions.LerpCoroutine(SizeText, 0, 1, fadeInTime + fadeOutTime));
                yield return(StartCoroutine(UtilFunctions.LerpCoroutine(FadeText, 0, 1, fadeInTime)));

                yield return(StartCoroutine(UtilFunctions.LerpCoroutine(FadeText, 1, 0, fadeInTime)));

                Destroy(currentMessage.gameObject);
            }
        }
        public IEnumerator SwitchMusic(AudioClip audioClip, float fadeTime, float newAudioMaxVolume)
        {
            crossAudio.volume = 0;
            crossAudio.clip   = audioClip;
            crossAudio.Play();

            crossMaxAudio = audioSource.volume;
            mainMaxAudio  = newAudioMaxVolume;

            AudioSource temp = audioSource;

            audioSource = crossAudio;
            crossAudio  = temp;

            yield return(StartCoroutine(UtilFunctions.LerpCoroutine(CrossFade, 0, 1, fadeTime)));
        }
Beispiel #11
0
        private IEnumerator PlayerDeath()
        {
            controller.StopInput();
            alive = false;
            playerCollider.enabled = false;
            StartCoroutine(UtilFunctions.LerpCoroutine(lantern.SetLightFraction, 1, 0, DEATH_TIME / 2));
            yield return(StartCoroutine(UtilFunctions.LerpCoroutine(PlayerFade, 1, 0, DEATH_TIME)));

            yield return(new WaitForSeconds(RESPAWN_WAIT));

            CinemachineVirtualCamera followCamera = FindObjectOfType <CinemachineVirtualCamera>();

            followCamera.Follow = this.transform;
            transform.position  = respawn.transform.position;
            StartCoroutine(UtilFunctions.LerpCoroutine(lantern.SetLightFraction, 0, 1, RESPAWN_TIME));
            yield return(StartCoroutine(UtilFunctions.LerpCoroutine(PlayerFade, 0, 1, RESPAWN_TIME)));

            playerCollider.enabled = true;
            controller.StartInput();
            alive = true;
        }
Beispiel #12
0
        private IEnumerator CameraShake()
        {
            yield return(new WaitForSeconds(shakeDelay));

            yield return(StartCoroutine(UtilFunctions.LerpCoroutine(UpdateIntensity, 1, 0, shakeDuration)));
        }