Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #include "Items/Treasure.h"
- #include "Characters/SlashCharacter.h"
- #include "Kismet\GameplayStatics.h"
- void ATreasure::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
- {
- //const FString OtherActorName = OtherActor->GetName();
- ASlashCharacter* SlashCharacter = Cast<ASlashCharacter>(OtherActor);
- if (SlashCharacter)
- {
- if (PickupSound)
- {
- UGameplayStatics::PlaySoundAtLocation
- (
- this,
- PickupSound,
- GetActorLocation()
- );
- }
- Destroy();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement