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

@ -55,6 +55,11 @@ void APickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* O
if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor)) if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor))
{ {
// TODO: Add extra functionality // TODO: Add extra functionality
if (PickupSoundBase)
{
UGameplayStatics::PlaySound2D(GetWorld(), PickupSoundBase);
}
Destroy(); Destroy();
} }
} }

View File

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