refactor: move gun Interact implementation from BP to C++
This commit is contained in:
parent
1beaad73bc
commit
24d4d951a3
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user