Setup NPC director

This commit is contained in:
koritsa
2026-06-01 16:26:15 +03:00
parent cf73d79190
commit 30e5e4ca41
17 changed files with 590 additions and 50 deletions
+14 -5
View File
@@ -45,8 +45,9 @@ public:
// Called by NPCAIController when an NPC gains or loses sight of the player. Observer is the
// observing pawn; its live location is re-traced each tick to weight embarrassment by the
// body parts that observer can actually see (GDD §7.1).
void SetObserved(bool bObserved, AActor* Observer);
// body parts that observer can actually see (GDD §7.1). Weight is the observer's NPC-type
// multiplier (§10.2) — Walkers read low, Stalkers high; ignored on the un-observe path.
void SetObserved(bool bObserved, AActor* Observer, float Weight = 1.0f);
// Number of NPCs currently perceiving the player (used by commission objectives, §13.4).
UFUNCTION(BlueprintPure)
@@ -84,7 +85,15 @@ private:
UPROPERTY()
TObjectPtr<ANakedDesireCharacter> OwnerCharacter;
// NPCs currently perceiving the player (added/removed via SetObserved). Weak so a destroyed
// observer drops out without dangling; stale entries are compacted during the tick.
TArray<TWeakObjectPtr<AActor>> Observers;
// One perceiving NPC and its observation weight (§10.2). Weak so a destroyed observer drops
// out without dangling.
struct FObserverEntry
{
TWeakObjectPtr<AActor> Actor;
float Weight = 1.0f;
};
// NPCs currently perceiving the player (added/removed via SetObserved). Stale entries are
// compacted during the tick.
TArray<FObserverEntry> Observers;
};