Updated NPC plan

This commit is contained in:
2026-06-01 19:12:00 +03:00
parent 192bd94bb7
commit 06fb3353b2
2 changed files with 89 additions and 0 deletions
@@ -3,6 +3,7 @@
#include "NPCAIController.h"
#include "NPC.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "Perception/AISense_Sight.h"
#include "Perception/AISenseConfig_Sight.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
@@ -68,4 +69,13 @@ void ANPCAIController::OnTargetPerceptionUpdate(AActor* Actor, FAIStimulus Stimu
bCurrentlyObserving = bSensed;
PlayerCharacter->StatsManager->SetObserved(bSensed, GetPawn(), GetObservationWeight());
// Surface the sighting to the behavior tree: the react/wander branch keys off "Player", and a
// fresh sighting re-arms the one-shot notice reaction (see the BT handoff in PLAN.md).
if (UBlackboardComponent* BB = GetBlackboardComponent())
{
BB->SetValueAsObject(TEXT("Player"), bSensed ? PlayerCharacter : nullptr);
if (!bSensed)
BB->SetValueAsBool(TEXT("bHasReacted"), false);
}
}