Files
UE5-Modular-Game-Framework/docs/blueprints/06-ui/54_WBP_ObjectiveDisplay.md
Lefteris Notas 411edea8ce add blueprints
2026-05-19 13:22:27 +03:00

86 lines
3.1 KiB
Markdown

# WBP_ObjectiveDisplay — Widget (Objective Display)
**Parent:** `UUserWidget`
**Used by:** `WBP_HUDController`, `BPC_ObjectiveSystem`
**Depends On:** `BPC_ObjectiveSystem`
---
### Purpose
Displays current objectives as an overlay on the HUD. Shows active objective text, objective markers, and progress indicators. Updates in real-time as objectives are added, completed, or updated.
### Variables
| Name | Type | Description |
|------|------|-------------|
| `ObjectiveText` | `TextBlock` | Current objective description |
| `ObjectiveMarker` | `Image` | Directional indicator if objective is off-screen |
| `ProgressBar` | `ProgressBar` | Objective progress (0-1) if applicable |
| `AnimFadeIn` | `WidgetAnimation` | Fade in on objective change |
| `AnimFadeOut` | `WidgetAnimation` | Fade out when objective completes |
| `AnimObjectiveComplete` | `WidgetAnimation` | Completion flourish |
| `ObjectiveQueue` | Array of `S_ObjectiveData` | Queued objectives for sequential display |
### Structs
```cpp
S_ObjectiveData
{
FText ObjectiveText;
FGameplayTag ObjectiveTag;
float Progress;
bool bIsComplete;
FVector WorldLocation; // For off-screen marker
}
```
### Functions
| Name | Inputs | Outputs | Description |
|------|--------|---------|-------------|
| `OnConstruct` | — | — | Bind to BPC_ObjectiveSystem dispatchers |
| `OnObjectiveActivated` | Objective: `S_ObjectiveData` | — | Show objective with fade-in animation |
| `OnObjectiveUpdated` | Objective: `S_ObjectiveData` | — | Update progress bar and text |
| `OnObjectiveCompleted` | ObjectiveTag: GameplayTag | — | Play completion animation, then fade out |
| `UpdateOffScreenMarker` | WorldLocation: FVector | — | Calculate screen position, rotate marker |
| `ClearAllObjectives` | — | — | Clear all active objective displays |
### Event Dispatchers
| Name | Parameters | Fired When |
|------|-----------|------------|
| `OnObjectiveDisplayed` | ObjectiveText: FText | New objective shown |
| `OnObjectiveCleared` | — | All objectives cleared |
### Communications With
| Target System | Method | Why |
|--------------|--------|-----|
| [`BPC_ObjectiveSystem`](../07-narrative/39_BPC_ObjectiveSystem.md) | Dispatcher | Receive objective changes |
| [`WBP_HUDController`](WBP_HUDController.md) | Parent reference | Coordinate visibility with other HUD elements |
### Blueprint Flow
```
[OnObjectiveActivated]
└─► Set ObjectiveText = Objective.ObjectiveText
└─► Set ProgressBar visibility based on objective type
└─► If objective has world location → Show ObjectiveMarker
└─► Play AnimFadeIn
└─► Broadcast OnObjectiveDisplayed
[OnObjectiveCompleted]
└─► Play AnimObjectiveComplete
└─► Delay 2.0 seconds
└─► Play AnimFadeOut
└─► Show next queued objective if any
[UpdateOffScreenMarker]
└─► Project world location to screen
└─► If behind camera → place at screen edge, rotate indicator
└─► Update ObjectiveMarker position + rotation
```
### Reuse Notes
- Created as part of Clean Slate refactoring (Master Section 6.6)
- Follows TEMPLATE.md format for all new blueprint specs