Complete MVP HUD frame

This commit is contained in:
2026-05-18 21:06:20 -07:00
parent e8d46c8238
commit df8bc6c7a8
4 changed files with 79 additions and 1 deletions
+28
View File
@@ -23,6 +23,7 @@ void AAgrarianDebugHUD::DrawHUD()
return;
}
DrawMvpHudFrame(AgrarianCharacter);
DrawInteractionPrompt(AgrarianCharacter);
DrawCriticalStats(AgrarianCharacter->GetSurvivalComponent());
const float InventoryBottomY = DrawInventoryPanel(AgrarianCharacter);
@@ -40,6 +41,33 @@ void AAgrarianDebugHUD::DrawHUD()
}
}
void AAgrarianDebugHUD::DrawMvpHudFrame(const AAgrarianGameCharacter* AgrarianCharacter)
{
if (!bShowMvpHudFrame || !AgrarianCharacter || !Canvas)
{
return;
}
const UAgrarianSurvivalComponent* SurvivalComponent = AgrarianCharacter->GetSurvivalComponent();
const FAgrarianSurvivalSnapshot* Survival = SurvivalComponent ? &SurvivalComponent->Survival : nullptr;
const float Scale = FMath::Max(0.25f, TextScale);
const float PanelWidth = FMath::Min(Canvas->ClipX - 64.0f, 620.0f * Scale);
const float PanelHeight = 54.0f * Scale;
const float X = (Canvas->ClipX - PanelWidth) * 0.5f;
const float Y = 26.0f;
DrawRect(FLinearColor(0.02f, 0.025f, 0.02f, 0.68f), X, Y, PanelWidth, PanelHeight);
DrawRect(FLinearColor(0.45f, 0.72f, 0.40f, 0.92f), X, Y, PanelWidth, 3.0f * Scale);
const FString StateText = Survival && Survival->bIsDead ? TEXT("DEAD") : TEXT("ALIVE");
const FString CoreStats = Survival
? FString::Printf(TEXT("Health %.0f Food %.0f Water %.0f Temp %.1fC"), Survival->Health, Survival->Hunger, Survival->Thirst, Survival->BodyTemperature)
: FString(TEXT("Survival unavailable"));
const FString HudText = FString::Printf(TEXT("AGRARIAN MVP | Ground Zero | %s | %s"), *StateText, *CoreStats);
DrawText(HudText, FColor(225, 235, 220), X + (18.0f * Scale), Y + (16.0f * Scale), nullptr, 0.86f * Scale, false);
}
void AAgrarianDebugHUD::DrawInteractionPrompt(const AAgrarianGameCharacter* AgrarianCharacter)
{
if (!bShowInteractionPrompt || !AgrarianCharacter || !AgrarianCharacter->HasInteractionPrompt() || !Canvas)
+4
View File
@@ -21,6 +21,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD")
bool bShowDebugHUD = true;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD")
bool bShowMvpHudFrame = true;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD")
bool bShowCriticalStatsHUD = true;
@@ -52,6 +55,7 @@ public:
float PromptTextScale = 1.15f;
protected:
void DrawMvpHudFrame(const class AAgrarianGameCharacter* AgrarianCharacter);
void DrawInteractionPrompt(const class AAgrarianGameCharacter* AgrarianCharacter);
void DrawCriticalStats(const UAgrarianSurvivalComponent* SurvivalComponent);
float DrawInventoryPanel(const class AAgrarianGameCharacter* AgrarianCharacter);