diff --git a/Source/vampires/Pickup.cpp b/Source/vampires/Pickup.cpp index 01c3200..faa37e3 100644 --- a/Source/vampires/Pickup.cpp +++ b/Source/vampires/Pickup.cpp @@ -78,6 +78,14 @@ void APickup::OnOuterBeginOverlap(UPrimitiveComponent* OverlappedComponent, AAct { PickupLocation = GetActorLocation(); PlayTimeLine(); + + double dist = FVector::Distance(GetActorLocation(), PlayerCharacter->GetActorLocation()); + + if (dist < OuterSphereComponent->GetScaledSphereRadius()) + { + double ratio = FMath::Abs((dist / OuterSphereComponent->GetScaledSphereRadius()) - 1.0f); + TimelineComponent->SetNewTime(ratio); + } } }