Exemplo n.º 1
0
    public void StartFinish(int time)
    {
        int minutes = time / 60;
        int seconds = time - minutes * 60;

        string minutesText = "";
        string secondsText = "";

        if (minutes < 10)
        {
            minutesText = "0" + minutes;
        }
        else
        {
            minutesText = minutes.ToString();
        }
        if (seconds < 10)
        {
            secondsText = "0" + seconds;
        }
        else
        {
            secondsText = seconds.ToString();
        }

        timeText.text = minutesText + ":" + secondsText;

        StartFinishAnim();
        MainGameLogic.GetMainCamera().GetComponent <UIManager>().OpenFinishCanvas();
        GetComponent <Canvas>().enabled = false;
        MainGameLogic.GetMainCamera().GetComponent <UIManager>().DisableMenuButton();

        //After finishing a game we delete the save file, no need for it anymore.
        //If we want to keep save games after finishing a game, I need to modify the save file
        //slightly to store whether the game has finished or not, to ensure equal states.
        MainGameLogic.DeleteSaveGame();
    }