Exemplo n.º 1
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;
            }
        }
    }
        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();
            }
        }
Exemplo n.º 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();
 }
Exemplo n.º 4
0
        private IEnumerator FadeInCoroutine()
        {
            yield return(StartCoroutine(FadeCoroutine(1f, 0f)));

            OnFadeIn.Invoke();
        }