52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
// © 2025 Naked People Team. All Rights Reserved.
|
|
|
|
|
|
#include "LocationRestriction.h"
|
|
#include "NakedDesire/Locations/LocationData.h"
|
|
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "Missions.Restrictions.Location"
|
|
const FText RestrictionsLocationDescription = LOCTEXT("Description", "Visit {LocationName}");
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
void ULocationRestriction::Init(ANakedDesireCharacter* PlayerCharacter)
|
|
{
|
|
Super::Init(PlayerCharacter);
|
|
|
|
// AreaEnterHandle = PlayerCharacter->OnAreaEnter.AddUObject(this, &ULocationRestriction::OnAreaEnter);
|
|
// AreaExitHandle = PlayerCharacter->OnAreaExit.AddUObject(this, &ULocationRestriction::OnAreaExit);
|
|
}
|
|
|
|
void ULocationRestriction::Stop()
|
|
{
|
|
Super::Stop();
|
|
|
|
// Player->OnAreaEnter.Remove(AreaEnterHandle);
|
|
// Player->OnAreaExit.Remove(AreaExitHandle);
|
|
}
|
|
|
|
FText ULocationRestriction::GetDescription() const
|
|
{
|
|
return FText::Format(RestrictionsLocationDescription,
|
|
FFormatNamedArguments
|
|
{
|
|
{TEXT("LocationName"), TargetLocation->Name}
|
|
});
|
|
}
|
|
|
|
void ULocationRestriction::OnAreaEnter(ULocationData* LocationData)
|
|
{
|
|
if (!IsSuccess && LocationData->Tag.MatchesTag(TargetLocation->Tag))
|
|
{
|
|
Complete();
|
|
}
|
|
}
|
|
|
|
void ULocationRestriction::OnAreaExit(ULocationData* LocationData)
|
|
{
|
|
if (IsSuccess && LocationData->Tag.MatchesTag(TargetLocation->Tag))
|
|
{
|
|
Init(Player);
|
|
}
|
|
}
|