Added commissions system
This commit is contained in:
@@ -88,10 +88,33 @@ void UStatsManager::SetObserved(const bool bObserved, AActor* Observer)
|
||||
if (!Observer)
|
||||
return;
|
||||
|
||||
bool bChanged = false;
|
||||
if (bObserved)
|
||||
Observers.AddUnique(Observer);
|
||||
{
|
||||
if (!Observers.Contains(Observer))
|
||||
{
|
||||
Observers.Add(Observer);
|
||||
bChanged = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
Observers.Remove(Observer);
|
||||
{
|
||||
bChanged = Observers.Remove(Observer) > 0;
|
||||
}
|
||||
|
||||
if (bChanged)
|
||||
OnObserversChanged.Broadcast();
|
||||
}
|
||||
|
||||
int32 UStatsManager::GetObserverCount() const
|
||||
{
|
||||
int32 Count = 0;
|
||||
for (const TWeakObjectPtr<AActor>& Observer : Observers)
|
||||
{
|
||||
if (Observer.IsValid())
|
||||
++Count;
|
||||
}
|
||||
return Count;
|
||||
}
|
||||
|
||||
void UStatsManager::IncreaseEmbarrassment(const float Amount)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class UClothingManager;
|
||||
class ANakedDesireCharacter;
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FAttributeUpdateSignature, float, CurrentValue, float, MaxValue);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FObserversChangedSignature);
|
||||
|
||||
|
||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
@@ -47,6 +48,14 @@ public:
|
||||
// body parts that observer can actually see (GDD §7.1).
|
||||
void SetObserved(bool bObserved, AActor* Observer);
|
||||
|
||||
// Number of NPCs currently perceiving the player (used by commission objectives, §13.4).
|
||||
UFUNCTION(BlueprintPure)
|
||||
int32 GetObserverCount() const;
|
||||
|
||||
// Fires whenever the observer set changes (an NPC gains or loses sight of the player).
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FObserversChangedSignature OnObserversChanged;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void IncreaseEmbarrassment(float Amount);
|
||||
void DecreaseEmbarrassment(float Amount);
|
||||
|
||||
Reference in New Issue
Block a user