Updated observation logic
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "StatsManager.generated.h"
|
||||
|
||||
class UClothingManager;
|
||||
class ANakedDesireCharacter;
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FAttributeUpdateSignature, float, CurrentValue, float, MaxValue);
|
||||
|
||||
|
||||
@@ -19,8 +21,6 @@ class NAKEDDESIRE_API UStatsManager : public UActorComponent
|
||||
float Energy = 1000.0f;
|
||||
float MaxEnergy = 1000.0f;
|
||||
|
||||
int32 ObserverCount = 0;
|
||||
|
||||
public:
|
||||
UStatsManager();
|
||||
|
||||
@@ -30,17 +30,22 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Embarrassment")
|
||||
float EmbarrassmentDecayRate = 1.0f;
|
||||
|
||||
protected:
|
||||
// Crowd scaling: N active observers multiply embarrassment gain by 1 + ObserverDensityScale * ln(N).
|
||||
// A single observer (N=1) is the x1 baseline; extra observers add with diminishing returns.
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Embarrassment")
|
||||
float ObserverDensityScale = 0.5f;
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||
void Init(UClothingManager* InClothingManager);
|
||||
|
||||
public:
|
||||
float Stamina = 100.0f;
|
||||
float MaxStamina = 100.0f;
|
||||
|
||||
// Called by NPCAIController when sight is gained or lost.
|
||||
// CoverageWeight: fraction of body covered [0..1]; pass 0.0f until #05 (GetEffectiveCoverage) lands.
|
||||
void SetObserved(bool bObserved, float CoverageWeight = 0.0f);
|
||||
// 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);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void IncreaseEmbarrassment(float Amount);
|
||||
@@ -58,4 +63,19 @@ public:
|
||||
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FAttributeUpdateSignature EnergyUpdate;
|
||||
|
||||
private:
|
||||
// Re-traces every current observer against the player's live coverage and returns the
|
||||
// normalized embarrassment-gain factor (0 when nothing revealing is currently observed).
|
||||
float ComputeObservedExposureRate();
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UClothingManager> ClothingManager;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user