Esempio n. 1
0
    public void ActivateBubble(string text, List <string> clickableTerms, DialogueMenuController.BubbleExpandDirection bubbleExpandDirection = DialogueMenuController.BubbleExpandDirection.RIGHT, int _bubbleParentX = -1, int _bubbleParentY = -1)
    {
        StopAllCoroutines();
        StartCoroutine(ExpandBubble(bubbleExpandDirection));

        UpdateBubbleContents(text, clickableTerms);

        bubbleParentX = _bubbleParentX;
        bubbleParentY = _bubbleParentY;
    }
Esempio n. 2
0
    IEnumerator ExpandBubble(DialogueMenuController.BubbleExpandDirection bubbleExpandDirection)
    {
        switch (bubbleExpandDirection)
        {
        case DialogueMenuController.BubbleExpandDirection.UP:
            DialogueBubble.fillMethod = Image.FillMethod.Vertical;
            DialogueBubble.fillOrigin = 0;
            break;

        case DialogueMenuController.BubbleExpandDirection.DOWN:
            DialogueBubble.fillMethod = Image.FillMethod.Vertical;
            DialogueBubble.fillOrigin = 1;
            break;

        case DialogueMenuController.BubbleExpandDirection.LEFT:
            DialogueBubble.fillMethod = Image.FillMethod.Horizontal;
            DialogueBubble.fillOrigin = 1;
            break;

        case DialogueMenuController.BubbleExpandDirection.RIGHT:
            DialogueBubble.fillMethod = Image.FillMethod.Horizontal;
            DialogueBubble.fillOrigin = 0;
            break;
        }

        DialogueBubble.fillAmount = 0f;

        float timeOfCompletion = Time.realtimeSinceStartup + timeToExpandBubble;

        while (Time.realtimeSinceStartup < timeOfCompletion)
        {
            float percentageComplete = 1 - (timeOfCompletion - Time.realtimeSinceStartup) / timeToExpandBubble;

            float curvedPercentage = GameManager.BelovedSwingCurve.Evaluate(percentageComplete);

            DialogueBubble.fillAmount = curvedPercentage;
            yield return(null);
        }

        DialogueBubble.fillAmount = 1f;
    }