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();
            }
        }
Exemple #2
0
    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;
            }
        }
    }
Exemple #3
0
 public virtual void EnableInspector(Tile t)
 {
     tileInspecting    = t;
     positionText.text = $"Position: ({t.GridPosition.x},{t.GridPosition.y})";
     animator.Play("Fade-in");
     OnFadeIn?.Invoke();
 }
Exemple #4
0
        private IEnumerator FadeInCoroutine()
        {
            yield return(StartCoroutine(FadeCoroutine(1f, 0f)));

            OnFadeIn.Invoke();
        }
Exemple #5
0
 private void DoFadeInEvent(OnFadeIn fade)
 {
     Fade(_canvasGroup.alpha, fullAlpha, fade.duration);
 }
Exemple #6
0
 private void OnDisable()
 {
     OnFade.UnregisterListener(DoFadeEvent);
     OnFadeIn.UnregisterListener(DoFadeInEvent);
     OnFadeOut.UnregisterListener(DoFadeOutEvent);
 }
Exemple #7
0
 private void OnEnable()
 {
     OnFade.RegisterListener(DoFadeEvent);
     OnFadeIn.RegisterListener(DoFadeInEvent);
     OnFadeOut.RegisterListener(DoFadeOutEvent);
 }
Exemple #8
0
        public void FadeInOneSecond()
        {
            OnFadeIn fade = new OnFadeIn(defaultDuration);

            fade.FireEvent();
        }