// © 2025 Naked People Team. All Rights Reserved.


#include "ObserverObjectiveBase.h"

#include "NakedDesire/Player/NakedDesireCharacter.h"
#include "NakedDesire/Stats/StatsManager.h"

void UObserverObjectiveBase::OnActivate()
{
	if (Player && Player->StatsManager)
		Player->StatsManager->OnObserversChanged.AddUniqueDynamic(this, &UObserverObjectiveBase::HandleObserversChanged);
}

void UObserverObjectiveBase::OnDeactivate()
{
	if (Player && Player->StatsManager)
		Player->StatsManager->OnObserversChanged.RemoveDynamic(this, &UObserverObjectiveBase::HandleObserversChanged);
}

int32 UObserverObjectiveBase::GetObserverCount() const
{
	return (Player && Player->StatsManager) ? Player->StatsManager->GetObserverCount() : 0;
}

void UObserverObjectiveBase::HandleObserversChanged()
{
	NotifyConditionChanged();
}