#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(); };