Updated TempCharacter to destory ammo ore

destroys ammo ore when the player presses e on it
This commit is contained in:
MH261677 2023-02-19 15:28:34 +00:00
parent 43ef8e2110
commit 3c2d057951
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -93,4 +93,6 @@ public:
FName Enemy;
FName Ammo;
};