public void StartConvertAnimation(bool isFadeIn, ExcuteNextScene callbackFunction = null) { if (isPlaying == true) { return; } StartCoroutine(FadeAnimation(isFadeIn, callbackFunction)); }
//Color.a = 1 불투명 //Color.a = 0 투명 IEnumerator FadeAnimation(bool isFadeIn, ExcuteNextScene callbackFunction) { isPlaying = true; Color color; if (isFadeIn) { color = fadeInColor; start = 1f; end = 0f; } else { color = fadeOutColor; start = 0f; end = 1f; } time = 0f; color.a = Mathf.Lerp(start, end, time); while (isFadeIn? color.a > 0f : color.a < 1f) { time += Time.deltaTime / animTime; color.a = Mathf.Lerp(start, end, time); animObject.color = color; yield return(null); } isPlaying = false; if (callbackFunction != null) { callbackFunction(); } }