Esempio n. 1
0
    protected override void OnClick()
    {
        bool gameSave  = GameSaver.SaveGameData();
        bool levelSave = GameSaver.SaveLevelData();

        message.sprite = gameSave && levelSave ? savedText : errorText;
        targetColor    = Color.white;
    }
Esempio n. 2
0
    protected override void Update()
    {
        if (!paused)
        {
            if (fadeIn)
            {
                float change = fadeRate * Time.deltaTime;
                if (render.color.a - change <= 0)
                {
                    render.color   = new Color(0, 0, 0, fadeAlpha);
                    fadeIn         = false;
                    render.enabled = false;

                    player.Frozen     = false;
                    player.InFallZone = false;
                    return;
                }
                render.color = new Color(0, 0, 0, render.color.a - change);
            }
            else if (fadeOut)
            {
                float change = fadeRate * Time.deltaTime;
                if (render.color.a + change >= 1)
                {
                    render.color = new Color(0, 0, 0, 1);
                    fadeOut      = false;
                    GameSaver.SaveGameData();
                    GameSaver.SaveLevelData(); //save the game
                    CallAfter();
                    player.Frozen     = false;
                    player.InFallZone = false;
                    return;
                }
                render.color = new Color(0, 0, 0, render.color.a + change);
            }
        }
    }