Exemplo n.º 1
0
    void OnGUI()
    {
        if (!gameOver)
        {
            GUIStyle style = new GUIStyle();
            style.normal.textColor = Color.black;
            style.fontSize         = 24;
            style.fontStyle        = FontStyle.Bold;
            GUI.Label(new Rect(10, 10, 100, 20), "Distance: " + Mathf.Round(metersMoved), style);
            GUI.Label(new Rect(10, 30, 100, 20), "Gold (100 each): " + GoldWorth * backpackController.TotalGold(), style);
        }
        else
        {
            GUIStyle gameOverStyle = new GUIStyle();
            gameOverStyle.normal.textColor = Color.red;
            gameOverStyle.fontSize         = 64;
            gameOverStyle.fontStyle        = FontStyle.Bold;
            gameOverStyle.alignment        = TextAnchor.LowerCenter;
            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2, 100, 20), "You Are Now\nStrapped To A Corpse\n(R to restart)", gameOverStyle);

            GUIStyle scoreStyle = new GUIStyle();
            scoreStyle.normal.textColor = Color.white;
            scoreStyle.fontSize         = 32;
            scoreStyle.fontStyle        = FontStyle.Bold;
            scoreStyle.alignment        = TextAnchor.LowerCenter;
            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 30, 100, 20), "Score: " + Score(), scoreStyle);
        }
    }