refactor: move gun Interact implementation from BP to C++

This commit is contained in:
Kubson96 2025-03-15 23:34:17 +01:00
parent 1beaad73bc
commit 24d4d951a3
5 changed files with 11 additions and 1 deletions

Binary file not shown.

View File

@ -3,6 +3,8 @@
#include "Items/GunBase.h"
#include "Characters/Components/ShootingComponent.h"
// Sets default values
AGunBase::AGunBase()
{
@ -25,3 +27,9 @@ void AGunBase::Tick(float DeltaTime)
}
void AGunBase::Interact_Implementation(AExoPlayerCharacter* playerCharacter)
{
playerCharacter->ShootingComponent->PickUpGun(this);
Destroy();
}

View File

@ -4,10 +4,11 @@
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Interfaces/Interactable.h"
#include "GunBase.generated.h"
UCLASS()
class EXO_API AGunBase : public AActor
class EXO_API AGunBase : public AActor, public IInteractable
{
GENERATED_BODY()
@ -44,4 +45,5 @@ public:
// Called every frame
virtual void Tick(float DeltaTime) override;
virtual void Interact_Implementation(AExoPlayerCharacter* playerCharacter) override;
};