43 lines
867 B
C++
43 lines
867 B
C++
// © 2025 Naked People Team. All Rights Reserved.
|
|
|
|
#include "MinTimeGoal.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "Missions.Goals.MinTime"
|
|
const FText GoalsMinTimeDescription = LOCTEXT("Description", "Do following at least {MinTime} seconds");
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
|
|
FText UMinTimeGoal::GetDescription() const
|
|
{
|
|
return FText::Format(GoalsMinTimeDescription,
|
|
FFormatNamedArguments
|
|
{
|
|
{TEXT("MinTime"), MinTime}
|
|
});
|
|
}
|
|
|
|
void UMinTimeGoal::OnRestrictionUpdated(UGoalRestriction* Restriction)
|
|
{
|
|
Super::OnRestrictionUpdated(Restriction);
|
|
|
|
if (CheckRestrictions())
|
|
{
|
|
if (!TimerHandle.IsValid())
|
|
{
|
|
GetWorld()->GetTimerManager().SetTimer(TimerHandle, this, &UMinTimeGoal::TimeIsUp, MinTime, false);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (TimerHandle.IsValid())
|
|
{
|
|
GetWorld()->GetTimerManager().ClearTimer(TimerHandle);
|
|
}
|
|
}
|
|
}
|
|
|
|
void UMinTimeGoal::TimeIsUp()
|
|
{
|
|
Complete();
|
|
}
|