Advertisement
Dieton

Tresure.cpp

Dec 13th, 2023 (edited)
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | Gaming | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3.  
  4. #include "Items/Treasure.h"
  5. #include "Characters/SlashCharacter.h"
  6. #include "Kismet\GameplayStatics.h"
  7.  
  8. void ATreasure::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
  9. {
  10.     //const FString OtherActorName = OtherActor->GetName();
  11.     ASlashCharacter* SlashCharacter = Cast<ASlashCharacter>(OtherActor);
  12.     if (SlashCharacter)
  13.     {
  14.         if (PickupSound)
  15.         {
  16.             UGameplayStatics::PlaySoundAtLocation
  17.             (
  18.                 this,
  19.                 PickupSound,
  20.                 GetActorLocation()
  21.             );
  22.         }
  23.         Destroy();
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement