public void OnAnimationEnd(AnimatorStateInfo stateInfo, int layerIndex) { if (stateInfo.IsName("FadeIn")) { onFadeIn?.Invoke(); OnFadeIn?.Invoke(); //Perform operations if (onFadeInFinish != null) { coroutineTasks = StartCoroutine(CoroutinePerformTasks(minSeconds, onFadeInFinish?.Invoke(), () => { FadeOut(); onTasksFinished?.Invoke(); })); } else { FadeOut(); onTasksFinished?.Invoke(); OnTasksFinished?.Invoke(); } onFadeInFinish = null; } else if (stateInfo.IsName("FadeOut")) { onFadeOut?.Invoke(); OnFadeOut?.Invoke(); } }
private IEnumerator FadeInLoop() { while (isFading) { if (fadePercentage > 0) { fadePercentage -= Time.deltaTime / fadeTime; } fadeImage.color = Color.Lerp(fadeColorEnd, fadeColorStart, fadePercentage); loadingWheel.color = Color.Lerp(loadingWheelColorEnd, loadingWheelColorStart, fadePercentage); yield return(null); if (fadePercentage <= 0) { if (OnFadeIn != null) { OnFadeIn.Invoke(); OnFadeIn.RemoveAllListeners(); } isFading = false; } } }
public virtual void EnableInspector(Tile t) { tileInspecting = t; positionText.text = $"Position: ({t.GridPosition.x},{t.GridPosition.y})"; animator.Play("Fade-in"); OnFadeIn?.Invoke(); }
private IEnumerator FadeInCoroutine() { yield return(StartCoroutine(FadeCoroutine(1f, 0f))); OnFadeIn.Invoke(); }
private void DoFadeInEvent(OnFadeIn fade) { Fade(_canvasGroup.alpha, fullAlpha, fade.duration); }
private void OnDisable() { OnFade.UnregisterListener(DoFadeEvent); OnFadeIn.UnregisterListener(DoFadeInEvent); OnFadeOut.UnregisterListener(DoFadeOutEvent); }
private void OnEnable() { OnFade.RegisterListener(DoFadeEvent); OnFadeIn.RegisterListener(DoFadeInEvent); OnFadeOut.RegisterListener(DoFadeOutEvent); }
public void FadeInOneSecond() { OnFadeIn fade = new OnFadeIn(defaultDuration); fade.FireEvent(); }