# Choice Timer

## ⏱️ ChoiceTimer Class

Displays a visual timer that represents the remaining time to make a choice.

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

***

### 📦 Fields

| Access   | Field               | Type         | Description                                                        |
| -------- | ------------------- | ------------ | ------------------------------------------------------------------ |
| `public` | `dontDestroyOnLoad` | `bool`       | If this object should not be destroyed when the scene is unloaded. |
| `public` | `choiceNode`        | `ChoiceNode` | The choice node that the timer is being displayed for.             |
| `public` | `onStart`           | `UnityEvent` | A callback for when the choice timer has started.                  |
| `public` | `onComplete`        | `UnityEvent` | A callback for when the choice timer has completed.                |
| `public` | `timeRemaining`     | `float`      | The amount of time remaining.                                      |

***

### 🔧 Properties

| Access            | Property   | Type          | Description                  |
| ----------------- | ---------- | ------------- | ---------------------------- |
| `public abstract` | `IsOpen`   | `bool`        | If the choice timer is open. |
| `public static`   | `Instance` | `ChoiceTimer` | The active instance.         |

***

### 🧰 Methods

| Access              | Method                   | Returns | Description                                                                           |
| ------------------- | ------------------------ | ------- | ------------------------------------------------------------------------------------- |
| `protected virtual` | `Awake()`                | `void`  | Virtual method for Unity Awake lifecycle.                                             |
| `protected virtual` | `Update()`               | `void`  | Virtual method for Unity Update lifecycle. Handles timer countdown and timeout logic. |
| `protected virtual` | `SelectTimeoutOption()`  | `void`  | Automatically selects the timeout option based on the choice node settings.           |
| `public virtual`    | `Stop()`                 | `void`  | Stops the timer.                                                                      |
| `public virtual`    | `Continue()`             | `void`  | Starts the timer.                                                                     |
| `public abstract`   | `Hide()`                 | `void`  | Abstract method to hide the timer.                                                    |
| `public abstract`   | `Show()`                 | `void`  | Abstract method to show the timer.                                                    |
| `public virtual`    | `StartTimer(ChoiceNode)` | `bool`  | Opens the choice timer based on the choice node. Returns true if successfully opened. |
| `public virtual`    | `Close()`                | `void`  | Closes the choice timer.                                                              |
| `public abstract`   | `Refresh()`              | `void`  | Abstract method to refresh the timer UI.                                              |
