Add Sound Effects to pickups

This commit is contained in:
baz 2024-08-25 03:42:55 +01:00
parent 3382a62b71
commit b0c46c615b
10 changed files with 29 additions and 9 deletions

Binary file not shown.

Binary file not shown.

BIN
Content/Pickups/EXP/BP_RedEXPPickup.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Pickups/Gold/BP_GoldPickup.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Sounds/coin-collection-2.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Sounds/coin-collection-2_Cue.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Sounds/coin-collection.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Sounds/coin-collection_Cue.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -53,8 +53,13 @@ void APickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* O
const FHitResult& SweepResult)
{
if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor))
{
{
// TODO: Add extra functionality
if (PickupSoundBase)
{
UGameplayStatics::PlaySound2D(GetWorld(), PickupSoundBase);
}
Destroy();
}
}

View File

@ -26,6 +26,9 @@ public:
UPROPERTY(EditAnywhere)
UPaperSpriteComponent* SpriteComponent = nullptr;
UPROPERTY(EditDefaultsOnly)
USoundBase* PickupSoundBase = nullptr;
public:
// Sets default values for this actor's properties