private IEnumerator Fade(float direction, RealtimeLight light)
    {
        light.gameObject.SetActive(true);
        direction = Mathf.Sign(direction);

        light.SetIntensity(direction > 0f ? 0f : 1.0f);

        float timer = 0.0f;

        while (timer < fadeDuration)
        {
            float t = Mathf.Clamp01(timer / fadeDuration);

            light.SetIntensity(direction > 0 ? t : (1.0f - t));

            if (direction > 0f)
            {
                light.SetLocalRotation(Quaternion.AngleAxis(180.0f - t * 180.0f, Vector3.right));
            }
            else
            {
                light.SetLocalRotation(Quaternion.AngleAxis(180.0f + (1.0f - t) * 180.0f, Vector3.right));
            }

            timer += Time.deltaTime;
            yield return(null);
        }

        light.SetIntensity(direction > 0f ? 1f : 0.0f);
        light.gameObject.SetActive(false);

        light.SetLocalRotation(direction > 0 ? Quaternion.AngleAxis(0.0f, Vector3.right) : Quaternion.AngleAxis(90.0f, Vector3.right));
    }
    private IEnumerator Idle(RealtimeLight light)
    {
        Debug.Log("Begin Idle on " + light.gameObject.name);
        light.gameObject.SetActive(true);
        yield return(new WaitForSeconds(m_IdleDuration));

        Debug.Log("Ending Idle on " + light.gameObject.name);
    }
    private IEnumerator Fade(float direction, RealtimeLight light)
    {
        light.gameObject.SetActive(true);
        direction = Mathf.Sign(direction);

        Debug.Log("Begin Fade on " + light.gameObject.name + " direction=" + direction);

        light.SetIntensity(direction > 0f ? 0f : 1.0f);

        if (m_LabelMeshFilter != null)
        {
            m_LabelMeshFilter.mesh = light.textMesh;
        }

        float timer = 0.0f;

        while (timer < m_FadeDuration)
        {
            float t = Mathf.Clamp01(timer / m_FadeDuration);

            light.SetIntensity(direction > 0 ? t : (1.0f - t));

            if (m_LabelMeshFilter != null)
            {
                if (direction > 0f)
                {
                    m_LabelMeshFilter.transform.localRotation = Quaternion.AngleAxis(180.0f - t * 180.0f, Vector3.right);
                }
                else
                {
                    m_LabelMeshFilter.transform.localRotation = Quaternion.AngleAxis(180.0f + (1.0f - t) * 180.0f, Vector3.right);
                }
            }

            timer += Time.deltaTime;
            yield return(null);
        }

        light.SetIntensity(direction > 0f ? 1f : 0.0f);
        light.gameObject.SetActive(false);

        if (m_LabelMeshFilter != null)
        {
            m_LabelMeshFilter.transform.localRotation = direction > 0 ? Quaternion.AngleAxis(0.0f, Vector3.right) : Quaternion.AngleAxis(90.0f, Vector3.right);
        }

        Debug.Log("Ending Fade on " + light.gameObject.name + " direction=" + direction);
    }
 private IEnumerator Idle(RealtimeLight light)
 {
     light.gameObject.SetActive(true);
     yield return(new WaitForSeconds(idleDuration));
 }