Updated observation logic
This commit is contained in:
@@ -58,6 +58,30 @@ bool UClothingManager::IsBodyPartExposed(const EBodyPart BodyPart)
|
||||
return true;
|
||||
}
|
||||
|
||||
float UClothingManager::GetEffectiveCoverage(const EBodyPart BodyPart)
|
||||
{
|
||||
// GDD §6.3.2: effective coverage of a part = max() across garments that include it.
|
||||
// A garment that doesn't cover the part contributes nothing; nothing covering it = 0.
|
||||
float MaxCoverage = 0.0f;
|
||||
for (const auto& [Slot, Instance] : EquippedClothing)
|
||||
{
|
||||
if (!Instance)
|
||||
continue;
|
||||
|
||||
const UClothingItemDefinition* Definition = Instance->GetClothingItemDefinition();
|
||||
if (!Definition)
|
||||
continue;
|
||||
|
||||
for (const FBodyPartCoverage& Coverage : Definition->CoveredBodyParts)
|
||||
{
|
||||
if (Coverage.BodyPart == BodyPart)
|
||||
MaxCoverage = FMath::Max(MaxCoverage, Coverage.Coverage);
|
||||
}
|
||||
}
|
||||
|
||||
return MaxCoverage;
|
||||
}
|
||||
|
||||
void UClothingManager::HydrateClothing()
|
||||
{
|
||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||
|
||||
@@ -46,6 +46,7 @@ public:
|
||||
TArray<UClothingItemInstance*> GetEquippedClothing() const;
|
||||
UClothingItemInstance* GetSlotClothing(EClothingSlotType SlotType);
|
||||
bool IsBodyPartExposed(EBodyPart BodyPart);
|
||||
float GetEffectiveCoverage(EBodyPart BodyPart);
|
||||
|
||||
void HydrateClothing();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user