Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void UDefaultsOverTimeEffect::OnWeightUpdated(UInventoryComponent* InventoryComponent)
- {
- float SummaryWeight = InventoryComponent->GetSummaryWeight();
- float MaxCarryWeight = InventoryComponent->GetOwner()->FindComponentByClass<UStatusComponent>()->GetAttributeActualValue(EAttributeType::MaxCarryWeight);
- float FilledOn = SummaryWeight / MaxCarryWeight;
- if (!OverweightEffect)
- {
- if (FilledOn >= 0.8f)
- {
- OverweightEffect = NewObject<UOverweightEffect>(GetStatusParent());
- GetStatusParent()->AddStatusEffect(OverweightEffect);
- if (FilledOn >= 1.f)
- {
- return;
- }
- }
- }
- else
- {
- if (FilledOn < 0.8)
- {
- GetStatusParent()->RemoveStatusEffect(OverweightEffect);
- OverweightEffect = nullptr;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement