Beispiel #1
0
    private IEnumerator CoFadeOutVignette(float duration)
    {
        for (float time = 0; time < duration; time += Time.deltaTime)
        {
            SetVignetteAlpha(MathX.EaseInQuad(vignetteColor.a, 0, time / duration));
            yield return(null);
        }

        canvas.SetActive(false);
    }
        private IEnumerator CoEnterScene()
        {
            loadOperation.allowSceneActivation = true;

            float enterDuration = transitionDuration / 2;

            for (float time = 0; time < enterDuration; time += Time.unscaledDeltaTime)
            {
                overlayMaterial.SetFloat(radiusID, MathX.EaseInQuad(time / enterDuration));
                yield return(null);
            }

            hasActiveTransition = false;
            gameObject.SetActive(false);
        }
Beispiel #3
0
    private void OnHeavyImpact(Vector2 point, Vector2 normal, float velocity)
    {
        if (transformation.State != TransformationState.Wolf)
        {
            return;
        }

        float power = MathX.EaseInQuad(minImpactPower, maxImpactPower,
                                       Mathf.InverseLerp(0, maxImpactVelocity, velocity));

        snappingCamera.Impact(-normal, power, impactDuration);

        if (Vector2.Dot(-normal, Vector2.up) <= 0.7f)
        {
            Instantiate(landingEffectPrefab, point, Quaternion.LookRotation(Vector3.forward, normal));
        }
        onHeavyImpact.Invoke();
    }
        private IEnumerator CoExitScene()
        {
            float exitDuration = transitionDuration / 2;

            for (float time = exitDuration; time > 0; time -= Time.unscaledDeltaTime)
            {
                overlayMaterial.SetFloat(radiusID, MathX.EaseInQuad(time / exitDuration));
                yield return(null);
            }

            // Wait until scene is ready to open
            while (loadOperation.progress < 0.9f)
            {
                yield return(null);
            }

            onBeforeEnterScene?.Invoke();
            StartCoroutine(CoEnterScene());
        }