Fixed linetrace, because it was follow only horizontal axis after locking character pitch. Added empty GunBase class with BP revolver item.
38 lines
915 B
C++
38 lines
915 B
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "Interfaces/Interactable.h"
|
|
#include "InteractionComponent.generated.h"
|
|
|
|
|
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
|
class EXO_API UInteractionComponent : public UActorComponent
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this component's properties
|
|
UInteractionComponent();
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Settings")
|
|
float InteractionDistance = 135.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Debug")
|
|
bool bShowDebugLine = false;
|
|
|
|
AActor *InteractedActor = nullptr;
|
|
|
|
protected:
|
|
// Called when the game starts
|
|
virtual void BeginPlay() override;
|
|
|
|
public:
|
|
// Called every frame
|
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
|
|
private:
|
|
void CheckForInteractable();
|
|
|
|
};
|