Exemplo n.º 1
0
    void OnGUI()
    {
        if (!_showBubble)
        {
            return;
        }
        var dia         = _dialogSystem.GetCurrent();
        var text        = dia.Player2;
        var showPlayer1 = false;

        switch (_currentPhase)
        {
        case DialogSystem.DialoguePhase.Player1Response:
            text        = dia.Player1Response;
            showPlayer1 = true;
            break;

        case DialogSystem.DialoguePhase.Player2Response:
            text = dia.Player2Response;
            break;
        }


        _style.normal.textColor = ColorPlayer2;
        var bubblePos = _bubblePos2;

        if (showPlayer1)
        {
            bubblePos = _bubblePos1;
            _style.normal.textColor = ColorPlayer1;
        }
        var renderedHeight = _style.CalcHeight(new GUIContent(text), BubbleBox.x);
        var boxRect        = new Rect(bubblePos.x - BubbleBox.x / 2, bubblePos.y - renderedHeight - BubbleBox.y, BubbleBox.x, BubbleBox.y);

        GUILayout.BeginArea(boxRect);
        GUILayout.Box(text, _style);
        GUILayout.EndArea();
    }