Ejemplo n.º 1
0
    void GoToMenu()
    {
        //Debug.Log("Presssing Back To Menu Button");

        // - TO TURN OFF IMMEDIATELY - //
        foreach (GameObject levelButton in levelButtons)
        {
            levelButton.SetActive(false);
        }

        backToMenuBtn.enabled = false;

        // - MAKE THE CLOUDS CLOSE - //
        foreach (MoveCloud cloud in cloudsToMove)
        {
            cloud.moveIn = true;
        }

        // - FADE OUT BACKTOMENU BTN - //
        backToMenuFadeScript.FadeOut();

        // - FADE IN TITLE - //
        titleFade.FadeIn();

        // - FADE IN SOLID BACKGROUND - //
        solidBGFade.FadeIn();

        // - FADE IN ALL BUTTONS - //
        fadeBtnIn = true;
    }
Ejemplo n.º 2
0
    void DoneDissolving()
    {
        // - ENABLE GAMEOBJECTS - // (Seperation lines, buttons, etc)
        foreach (GameObject summerObj in summerObjs)
        {
            if (!summerObj.activeSelf)
            {
                summerObj.SetActive(true);
            }
        }

        backToMenuFadeScript.FadeIn();
        backToMenuBtn.enabled = true;
    }
Ejemplo n.º 3
0
    void Update()
    {
        // Keep track of the current active scene.
        currentScene = SceneManager.GetActiveScene().name;

        titleCardTxt.color = new Color(titleCardTxt.color.r, titleCardTxt.color.g, titleCardTxt.color.b, titleCardImg.color.a);

        // -- FADE OUT CURRENT SCENE -- //
        if (fadeSceneOut)
        {
            if (fadeSceneIn)
            {
                fadeSceneIn = false;
            }
            // Set the transition image to raycast target to block the player from tapping on any buttons while it is transitioning.
            if (!fadeImage.raycastTarget)
            {
                fadeImage.raycastTarget = true;
            }
            curveTime      += Time.deltaTime / fadeTime;
            newAlpha        = animCurve.Evaluate(curveTime);
            fadeImage.color = new Color(fadeImage.color.r, fadeImage.color.g, fadeImage.color.b, newAlpha);

            if (newAlpha >= 0.8)
            {
                if (titleCardTxt.text != sceneToLoad)
                {
                    titleCardTxt.text = sceneToLoad;
                }
                // start playing music for the scene here
                if (!titleCardObj.activeInHierarchy)
                {
                    titleCardObj.SetActive(true);
                    titleCardFadeScript.FadeIn();
                }

                if (titleCardImg.color.a >= 1 && titleCardTimer < minTitleCardShowTime)
                {
                    titleCardTimer += Time.deltaTime;
                }
            }

            // If transition and titlecard faded in completely.
            if (newAlpha >= 1 && titleCardImg.color.a >= 1 && currentScene != sceneToLoad)
            {
                curveTime = 1;
                newAlpha  = 1;
                SceneManager.LoadScene(sceneToLoad);
            }
            // If scene has been loaded and title card has been on long enough.
            if (currentScene == sceneToLoad && titleCardTimer >= minTitleCardShowTime)
            {
                fadeSceneIn  = true;
                fadeSceneOut = false;
                SceneManager.LoadScene(sceneToLoad);
                titleCardTimer = 0f;
            }
        }

        // -- FADE IN NEW SCENE -- //
        if (fadeSceneIn)
        {
            titleCardFadeScript.FadeOut();
            if (titleCardImg.color.a <= 0.5f)
            {
                ;
            }
            {
                curveTime      -= Time.deltaTime / fadeTime;
                newAlpha        = animCurve.Evaluate(curveTime);
                fadeImage.color = new Color(fadeImage.color.r, fadeImage.color.g, fadeImage.color.b, newAlpha);
            }
            if (newAlpha <= 0.2)
            {
                if (fadeImage.raycastTarget)
                {
                    fadeImage.raycastTarget = false;
                }
            }
            if (newAlpha <= 0)
            {
                //if (fadeImage.raycastTarget) { fadeImage.raycastTarget = false; }
                curveTime   = 0;
                newAlpha    = 0;
                fadeSceneIn = false;
            }
        }
    }