Esempio n. 1
0
    private void OnGUI()
    {
        FinalScore finalScore = FindObjectOfType <FinalScore>();

        if (finalScore == null || finalScore.isGameOver)
        {
            return;
        }

        foreach (FloatingScore floatingScore in floatingScores)
        {
            Vector3 screenPoint = Camera.main.WorldToScreenPoint(new Vector2(floatingScore.pos.x, -floatingScore.pos.y));
            Color   textColor   = new Color(1.0f, 0.9f, 0.3f);
            int     fontHeight  = Mathf.RoundToInt(Mathf.Lerp(60.0f, 100.0f, Mathf.Clamp01((floatingScore.score - 10.0f) / 60.0f)));
            Bgm.shadedText(new Rect(screenPoint.x - 500.0f, screenPoint.y - 50.0f, 1000.0f, 100.0f), "" + floatingScore.score + "€", fontHeight, textColor);
        }

        {
            GUIStyle style = GUIStyle.none;
            style.normal.textColor = new Color(1.0f, 1.0f, 0.5f, 0.8f);
            style.fontStyle        = FontStyle.Bold;
            style.fontSize         = 45;
            style.fontSize         = scaleFont(style.fontSize);
            style.alignment        = TextAnchor.MiddleCenter;

            Rect pixelRect = Camera.main.pixelRect;
            Rect iconRect  = pixelRect;
            iconRect.height *= 0.1f;
            iconRect.width   = iconRect.height;
            iconRect.x       = pixelRect.width * 0.5f - iconRect.width;
            iconRect.y      += pixelRect.height * 0.02f;
            GUI.DrawTexture(iconRect, moneyTexture);

            Rect textRect = iconRect;
            textRect.y -= iconRect.height * 0.02f;
            Bgm.shadedText(textRect, "" + money, 45, style.normal.textColor);

            style.normal.textColor = new Color(0.0f, 0.0f, 0.0f, 0.5f);
            iconRect.x            += iconRect.width;
            GUI.DrawTexture(iconRect, filmTexture);

            style.fontSize = 60;
            style.fontSize = scaleFont(style.fontSize);

            textRect    = iconRect;
            textRect.y -= iconRect.height * 0.02f;
            textRect.x -= iconRect.height * 0.01f;
            GUI.Label(textRect, "" + filmLeft, style);
        }
    }
Esempio n. 2
0
    void OnGUI()
    {
        if (!ended)
        {
            return;
        }

        Color textColor = new Color(1.0f, 1.0f, 0.2f);

        Rect pixelRect = Camera.main.pixelRect;

        pixelRect.y -= 50;
        Bgm.shadedText(pixelRect, "Money money money " + finalScore + "€", 80, textColor);

        if (endTime + restartDuration < Time.time)
        {
            pixelRect.y += 100;
            Bgm.shadedText(pixelRect, "Press any button to restart", 80, textColor);
        }
    }