Ejemplo n.º 1
0
    private void StartGame()
    {
        enabled = false;

        float fadeDuration = 1.5f;

        ScreenFader.FadeToWhite(2.0f, OnFadeComplete);
        title.DOFade(0.0f, fadeDuration);
        clickToRestart.DOFade(0.0f, fadeDuration);
        infoText.DOFade(0.0f, fadeDuration);
        greenBarTitle.DOFade(0.0f, fadeDuration);
        greenBarClickToBegin.DOFade(0.0f, fadeDuration);
    }
    static public void TransitionToScene(string scene, float duration, FadeColor fadeColor, SceneTransitionCallback callback = null)
    {
        _toScene    = scene;
        _toCallback = callback;

        if (fadeColor == FadeColor.Black)
        {
            ScreenFader.FadeToBlack(duration, OnFadeOutComplete);
        }
        else if (fadeColor == FadeColor.White)
        {
            ScreenFader.FadeToWhite(duration, OnFadeOutComplete);
        }
    }
Ejemplo n.º 3
0
    IEnumerator CoWinScreen()
    {
        fadeScreen.FadeToWhite();
        ClearScreen();
        yield return(yieldInstruction1);

        cameraman.backgroundColor = ColorSelector.darkColor;
        TurnOn(congratulations.gameObject);
        fadeScreen.DeFade(congratulations, null);
        yield return(yieldInstruction03);

        TurnOn(resultStars.gameObject);

        switch (score)
        {       //All stars.
        case 0:
            resultStars.GetChild(0).GetComponent <Image>().sprite = winstar;
            resultStars.GetChild(1).GetComponent <Image>().sprite = winstar;
            resultStars.GetChild(2).GetComponent <Image>().sprite = winstar;
            break;

        //Lose one star.
        case -1:
        case -2:
            resultStars.GetChild(0).GetComponent <Image>().sprite = winstar;
            resultStars.GetChild(1).GetComponent <Image>().sprite = winstar;
            resultStars.GetChild(2).GetComponent <Image>().sprite = failstar;
            break;

        //Lose two stars.
        case -3:
        case -4:
            resultStars.GetChild(0).GetComponent <Image>().sprite = winstar;
            resultStars.GetChild(1).GetComponent <Image>().sprite = failstar;
            resultStars.GetChild(2).GetComponent <Image>().sprite = failstar;
            break;

        //Above zero and under -5. Attention to the if clause. It should be impossible to finish with a score above zero.
        default:
            resultStars.GetChild(0).GetComponent <Image>().sprite = failstar;
            resultStars.GetChild(1).GetComponent <Image>().sprite = failstar;
            resultStars.GetChild(2).GetComponent <Image>().sprite = failstar;
            break;
        }

        resultStars.GetChild(0).GetComponent <Image>().color = Color.clear;
        resultStars.GetChild(1).GetComponent <Image>().color = Color.clear;
        resultStars.GetChild(2).GetComponent <Image>().color = Color.clear;

        for (int i = 0; i < 3; i++)
        {
            fadeScreen.DeFade(null, resultStars.GetChild(i).GetComponent <Image>());
            yield return(yieldInstruction03);
        }

        nextgame.GetComponent <Button>().interactable  = false;
        selScreen.GetComponent <Button>().interactable = false;
        playagain.GetComponent <Button>().interactable = false;

        TurnOn(nextgame.gameObject);
        fadeScreen.DeFade(null, nextgame);
        yield return(yieldInstruction03);

        TurnOn(selScreen.gameObject);
        fadeScreen.DeFade(null, selScreen);
        yield return(yieldInstruction03);

        TurnOn(playagain.gameObject);
        fadeScreen.DeFade(null, playagain);
        yield return(yieldInstruction03);

        nextgame.GetComponent <Button>().interactable  = true;
        selScreen.GetComponent <Button>().interactable = true;
        playagain.GetComponent <Button>().interactable = true;
    }