init
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// © 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();
|
||||
}
|
||||
Reference in New Issue
Block a user