2025-02-05 23:12:03 +00:00
|
|
|
// Louis Hobbs | 2024-2025
|
2024-06-19 17:24:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
#include "GoldPickup.h"
|
|
|
|
|
2024-11-14 18:39:20 +00:00
|
|
|
#include "GoldComponent.h"
|
2024-06-24 21:42:33 +01:00
|
|
|
|
|
|
|
class APlayerCharacter;
|
|
|
|
|
2024-06-19 17:24:36 +01:00
|
|
|
void AGoldPickup::BeginPlay()
|
|
|
|
{
|
|
|
|
Super::BeginPlay();
|
|
|
|
}
|
|
|
|
|
2024-11-14 22:49:59 +00:00
|
|
|
void AGoldPickup::OnInnerBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
2024-11-18 02:23:30 +00:00
|
|
|
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
|
|
|
const FHitResult& SweepResult)
|
2024-06-19 17:24:36 +01:00
|
|
|
{
|
2025-07-29 22:06:42 +01:00
|
|
|
if (UGoldComponent* GoldComponent = OtherActor->GetComponentByClass<UGoldComponent>())
|
2024-06-24 21:42:33 +01:00
|
|
|
{
|
2025-07-29 22:06:42 +01:00
|
|
|
GoldComponent->IncrementGold(PickupValue);
|
2024-11-14 22:49:59 +00:00
|
|
|
Super::OnInnerBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
|
2024-06-24 21:42:33 +01:00
|
|
|
}
|
2024-06-19 17:24:36 +01:00
|
|
|
}
|