Files
Naked-Desire/Source/NakedDesire/UI/HUDWidget.cpp
T

24 lines
663 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "HUDWidget.h"
#include "Components/ProgressBar.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
#include "NakedDesire/Stats/StatsManager.h"
void UHUDWidget::NativeConstruct()
{
Super::NativeConstruct();
const ANakedDesireCharacter* Player = Cast<ANakedDesireCharacter>(GetOwningPlayerPawn());
if (!Player)
return;
Player->StatsManager->EmbarrassmentUpdate.AddUniqueDynamic(this, &UHUDWidget::OnEmbarrassmentUpdated);
}
void UHUDWidget::OnEmbarrassmentUpdated(float CurrentValue, float MaxValue)
{
EmbarrassmentBar->SetPercent(CurrentValue / MaxValue);
}