Esempio n. 1
0
    public void HideGameMenu()
    {
        LeanTween.cancel(gameObject, false);
        player.StopChangeLevelTextAlpha();
        LeanTweenEx.InvokeNextFrame(exitButton.gameObject, () => isInMenu = false);

        canvasGroup.interactable   = false;
        canvasGroup.blocksRaycasts = false;

        virtualCamera.Follow = player.transform;
        LeanTween.value(gameObject, virtualCamera.m_Lens.OrthographicSize, 5.0f, 1.0f)
        .setOnUpdate((float size) => {
            virtualCamera.m_Lens.OrthographicSize = size;
        });

        LeanTween.value(gameObject, chromaticAberration.intensity.value, defaultChromaticAberrationIntensity, 0.33f)
        .setOnUpdate((float intensity) => {
            chromaticAberration.intensity.value = intensity;
        });

        LeanTween.value(gameObject, grain.intensity.value, 0, 0.33f)
        .setOnUpdate((float intensity) => {
            grain.intensity.value = intensity;
        });

        LeanTweenEx.ChangeCanvasGroupAlpha(gameObject, canvasGroup, 0.0f, 0.33f);

        player.ChangeLevelTextAlpha(0.33f, 1.0f, false);

        optionsMenu.HideCanvas();
        levelsSelectionMenu.HideCanvas();
    }
    public void UpdateValue(int newValue)
    {
        float delta = Mathf.Abs(currValue - newValue);

        if (delta == 0)
        {
            LeanTweenEx.InvokeNextFrame(gameObject, onValueUpdated);
            return;
        }

        if (newValue - currValue > 0)
        {
            for (int i = currValue; i < newValue; ++i)
            {
                sectors[i].Fill(fillTime, (i - currValue) * fillTime);
            }
        }
        else
        {
            for (int i = currValue - 1; i >= newValue; --i)
            {
                sectors[i].UnFill(fillTime, (currValue - i - 1) * fillTime);
            }
        }

        currValue = newValue;

        LeanTween.delayedCall(gameObject, fillTime * delta, onValueUpdated);
    }