Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. void UDefaultsOverTimeEffect::OnWeightUpdated(UInventoryComponent* InventoryComponent)
  2. {
  3. float SummaryWeight = InventoryComponent->GetSummaryWeight();
  4. float MaxCarryWeight = InventoryComponent->GetOwner()->FindComponentByClass<UStatusComponent>()->GetAttributeActualValue(EAttributeType::MaxCarryWeight);
  5. float FilledOn = SummaryWeight / MaxCarryWeight;
  6. if (!OverweightEffect)
  7. {
  8. if (FilledOn >= 0.8f)
  9. {
  10. OverweightEffect = NewObject<UOverweightEffect>(GetStatusParent());
  11. GetStatusParent()->AddStatusEffect(OverweightEffect);
  12. if (FilledOn >= 1.f)
  13. {
  14. return;
  15. }
  16. }
  17. }
  18. else
  19. {
  20. if (FilledOn < 0.8)
  21. {
  22. GetStatusParent()->RemoveStatusEffect(OverweightEffect);
  23. OverweightEffect = nullptr;
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement