CLifeWidget
Overview
UCLifeWidget is a world-projected health bar widget. It displays a UProgressBar that reflects the actor’s current life from UCLifeComponent. The bar color changes based on team attitude (Friendly, Neutral, Hostile) and the bar is hidden when the actor is at full health and not in combat.
Implements ICWidgetWorld for world-space projection below the actor’s capsule.
Functions
| Name | Description |
|---|---|
| consume | Initializes the widget: sets source pawn and binds progress bar delegates |
| lifeProgressBarPercent | Returns normalized life (0..1) from UCLifeComponent |
| lifeProgressBarColor | Returns a color based on team attitude and life percentage (3-color gradient per attitude) |
| lifeProgressVisibility | Shows the bar when life is below max or when a hostile actor is detected by the AI controller |
| worldData | Returns world projection data: draw size, transform offset above capsule, material |
// UCLifeWidget receives data via consume:
// - object: source pawn (APawn*)
// The progress bar uses delegate binding:
// - PercentDelegate -> lifeProgressBarPercent()
// - FillColorAndOpacityDelegate -> lifeProgressBarColor()
// - VisibilityDelegate -> lifeProgressVisibility()
// Team attitude color mapping:
// Friendly: orange -> yellow -> cyan
// Neutral: orange -> green -> green
// Hostile: red -> dark red -> darker red
// World projection places the bar below the capsule half-height.