From 3c2d0579515402632b344f15b5b16f9dd070b2b0 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sun, 19 Feb 2023 15:28:34 +0000 Subject: [PATCH] Updated TempCharacter to destory ammo ore destroys ammo ore when the player presses e on it --- Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 6 ++++++ Source/the_twilight_abyss/PlayerTemp/TempCharacter.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 6a7ace7..6710218 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -40,6 +40,8 @@ void ATempCharacter::BeginPlay() Enemy = TEXT("Enemy"); UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors); + + Ammo = TEXT("Ammo"); } //Binds the input we made in the setup player component to the forward vector @@ -150,6 +152,10 @@ void ATempCharacter::LineTraceLogic() { UE_LOG(LogTemp, Display, TEXT("Not Enough Gold")); } + if(OutHit.GetActor()->ActorHasTag(Ammo)) + { + OutHit.GetActor()->Destroy(); + } } // if the actor hit has the interaction component/script then it will activate the code diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 44ba91e..57675b2 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -93,4 +93,6 @@ public: FName Enemy; + FName Ammo; + };