Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void FadeIn(float delayBefore = 0, float delayAfter = 0, System.Action callback = null)
- {
- if (callback == null) callback = DefaultCallback;
- group.gameObject.SetActive(true);
- StopActiveFades();
- fadeInCR = instance.StartCoroutine(instance.FadeInCoRoutine(delayBefore, delayAfter,callback));
- }
- IEnumerator FadeInCoRoutine(float delayBefore, float delayAfter, System.Action callback)
- {
- yield return new WaitForSeconds(delayBefore);
- while (group.alpha > 0)
- {
- group.alpha = Mathf.MoveTowards(group.alpha, 0f, instance.speed * Time.deltaTime);
- yield return null;
- }
- yield return new WaitForSeconds(delayAfter);
- if (callback != null) callback();
- group.gameObject.SetActive(false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement