ExoWest/Source/Exo/Public/Player/InteractionComponent.h
Kubson96 b97d63bad5 feat: add interaction input, implement in controller
Added interaction input.
Modified InteractionComponent - write ptr to hit object.
Implemented interact action in player controller.
2025-02-17 15:28:18 +01:00

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 = 100.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();
};