# Emotion Bubble

## 💭 EmotionBubble Class

A component used to display an emotion that a speaker is feeling, with billboarding and animation support.

> Namespace: `Esper.FeelSpeak.UI.UGUI`\
> Inherits from: `Billboarded`\
> Type: `class`

***

### 📦 Fields

| Access   | Field          | Type           | Description                                                                     |
| -------- | -------------- | -------------- | ------------------------------------------------------------------------------- |
| `public` | `emotionImage` | `Image`        | The image that displays the emotion.                                            |
| `public` | `line`         | `LineRenderer` | The line renderer (hidden in inspector).                                        |
| `public` | `animator`     | `Animator`     | The animator component (hidden in inspector).                                   |
| `public` | `pointAnchor`  | `Transform`    | An anchor that keeps the end of the line renderer at a specific world position. |

***

### 🏷️ Properties

| Access   | Property | Type   | Description                                        |
| -------- | -------- | ------ | -------------------------------------------------- |
| `public` | `IsOpen` | `bool` | Gets whether the emotion bubble is currently open. |

***

### 📡 Static Events

| Access   | Event     | Type                        | Description                                 |
| -------- | --------- | --------------------------- | ------------------------------------------- |
| `public` | `onOpen`  | `UnityEvent<EmotionBubble>` | Callback when any emotion bubble is opened. |
| `public` | `onClose` | `UnityEvent<EmotionBubble>` | Callback when any emotion bubble is closed. |

***

### 🧰 Methods

| Access      | Method                  | Returns | Description                                                                 |
| ----------- | ----------------------- | ------- | --------------------------------------------------------------------------- |
| `protected` | `Awake()`               | `void`  | Initializes components and sets the bubble to inactive state.               |
| `protected` | `Update()`              | `void`  | Updates the base billboarding behavior and bubble line positioning.         |
| `protected` | `UpdateBubbleLine()`    | `void`  | Updates the bubble pointer line between the bubble and point anchor.        |
| `public`    | `Open(Sprite, float?)`  | `void`  | Opens the bubble to display a custom sprite with optional display duration. |
| `public`    | `Open(Emotion, float?)` | `void`  | Opens the bubble to display an emotion with optional display duration.      |
| `public`    | `Close()`               | `void`  | Closes the bubble using animation or direct deactivation.                   |
| `public`    | `SetInactive()`         | `void`  | Sets the bubble GameObject inactive.                                        |
