示例#1
0
    public ScreenAnimationFadeOut()
    {
        FadeEffect effect = FadeEffect.Instance;

        if (effect == null)
        {
            Debug.LogWarning("You need attach FadeEffect on to the main camera.");
            GameObject mainCamera = GameObject.FindGameObjectWithTag("MainCamera");
            if (mainCamera == null)
            {
                throw new UnityException("Can't find MainCamera");
            }
            effect = GameObject.FindGameObjectWithTag("MainCamera").AddComponent <FadeEffect>();
        }

        if (fadeoutCoroutine != null)
        {
            effect.StopCoroutine(fadeoutCoroutine);
        }
        fadeoutCoroutine = FadeEffect.Instance.StartFadeOut();
    }