Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lightController"></param>
        /// <returns></returns>
        private IEnumerator LightFlickerCoroutine(LightController lightController)
        {
            yield return(new WaitForSeconds(Random.Range(_startDelayMin, _startDelayMax)));

            var currentIntensity = lightController.intensity;
            var count            = Random.Range(_flickerCountMin, _flickerCountMax + 1);

            for (var i = 0; i < count; ++i)
            {
                lightController.Flicker(Random.Range(_intervalMin, _intervalMax), 0.0f);

                yield return(new WaitForSeconds(Random.Range(_flickerDurationMin, _flickerDurationMax)));

                lightController.StopFlickering();
                yield return(lightController.WaitForFlicker());
            }

            lightController.intensity = currentIntensity;
            SetupLightFlicker(lightController);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="lightController"></param>
 private void SetupLightFlicker(LightController lightController)
 {
     lightController.StartCoroutine(LightFlickerCoroutine(lightController));
 }