# Speaker

## 🧍 Speaker Class

Represents a character in the game world that can speak.

> Namespace: `Esper.FeelSpeak.Overworld`\
> Inherits from: `MonoBehaviour`\
> Type: `class`

***

### 📦 Fields

| Access      | Field               | Type            | Description                                                           |
| ----------- | ------------------- | --------------- | --------------------------------------------------------------------- |
| `public`    | `character`         | `Character`     | The character.                                                        |
| `public`    | `dialogue`          | `DialogueGraph` | The dialogue that is triggered when interacting with this speaker.    |
| `public`    | `emotionBubble`     | `EmotionBubble` | The emotion bubble used by this speaker.                              |
| `public`    | `voiceAudioSource`  | `AudioSource`   | The audio source for the character's voice.                           |
| `public`    | `inRangeIndicator`  | `GameObject`    | An object that is enabled when the player is in range of the speaker. |
| `public`    | `onInteracted`      | `UnityEvent`    | A callback for when the player has interacted with this speaker.      |
| `protected` | `animator`          | `Animator`      | The animator component.                                               |
| `protected` | `interactionAction` | `Action`        | The action to invoke when Interact() is called.                       |

***

### 📋 Properties

| Access   | Property     | Type   | Description                            |
| -------- | ------------ | ------ | -------------------------------------- |
| `public` | `IsSpeaking` | `bool` | If this speaker is currently speaking. |

***

### 🧰 Methods

| Access      | Method                                                | Returns | Description                                              |
| ----------- | ----------------------------------------------------- | ------- | -------------------------------------------------------- |
| `protected` | `Awake()`                                             | `void`  | Unity lifecycle method for initialization.               |
| `private`   | `OnTriggerEnter(Collider other)`                      | `void`  | Handles 3D trigger enter events.                         |
| `private`   | `OnTriggerEnter2D(Collider2D collision)`              | `void`  | Handles 2D trigger enter events.                         |
| `private`   | `OnTriggerExit(Collider other)`                       | `void`  | Handles 3D trigger exit events.                          |
| `private`   | `OnTriggerExit2D(Collider2D collision)`               | `void`  | Handles 2D trigger exit events.                          |
| `private`   | `OnDestroy()`                                         | `void`  | Unity lifecycle method for cleanup.                      |
| `public`    | `PlayAnimation(string animationName, int layer = -1)` | `void`  | Plays an animation.                                      |
| `public`    | `StopVoiceLine()`                                     | `void`  | Stops the currently playing voice line.                  |
| `public`    | `PlayVoiceLine(AudioClip audioClip)`                  | `void`  | Plays a voice line audio clip.                           |
| `public`    | `TriggerDialogue()`                                   | `void`  | Starts dialogue with this speaker.                       |
| `public`    | `Interact()`                                          | `void`  | Interacts with the speaker (invokes interaction action). |
