private void OnEnable()
    {
        ConversationBubbleOrientationManager.InitializeSprites(leftBubble, centerBubble, rightBubble);

        bubbleElements = new BubbleDisplay(this.gameObject, isResponse);

        builder = new StringBuilder();

        currentOrientation = ConversationBubbleOrientation.Center;
    }
    public void InitializeSnippetTransform(Vector2 pos, bool focused)
    {
        float scale = 1;

        if (focused)
        {
            currentOrientation = ConversationBubbleOrientation.Right;
            scale = focusedScaleFactor;
        }
        else
        {
            bool useLeftSprite = pos.x >= 0;
            currentOrientation = useLeftSprite ? ConversationBubbleOrientation.Left : ConversationBubbleOrientation.Right;
        }

        SetPositionAndScale(pos, scale);

        bubbleElements.SetFromOrientation(currentOrientation);
    }
    private IEnumerator OrientSnippetToFocusedPosition(float time)
    {
        var orientations = isResponse
            ? ConversationBubbleOrientationManager.MoveToRight(currentOrientation.BubbleOrientation)
            : ConversationBubbleOrientationManager.MoveToLeft(currentOrientation.BubbleOrientation);

        ConversationBubbleOrientation newOrientation = currentOrientation;

        float timeInterval = time / (orientations.Length + 1);

        foreach (var orientation in orientations)
        {
            yield return(new WaitForSeconds(timeInterval));

            newOrientation = orientation;

            bubbleElements.SetFromOrientation(newOrientation);
        }

        currentOrientation = newOrientation;
    }
 private static ConversationBubbleOrientation[] MoveTowardsOrientation(BubbleOrientation start, BubbleOrientation desired)
 {
     if (start.Equals(desired))
     {
         return(Array.Empty <ConversationBubbleOrientation>());
     }
     else
     {
         ConversationBubbleOrientation opposite = GetOpposite(start);
         return(start.Equals(BubbleOrientation.CENTER)
             ? new ConversationBubbleOrientation[]
         {
             opposite
         }
             : new ConversationBubbleOrientation[]
         {
             ConversationBubbleOrientation.Center,
             opposite
         });
     }
 }
 public void SetFromOrientation(ConversationBubbleOrientation orientation)
 {
     SetBackingImage(orientation.SpriteForOrientation);
     AdjustTmpTransform(orientation.TmpLocalPosition, orientation.TmpEulers);
 }