Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
InteractionComponent.h
이 파일의 문서화 페이지로 가기
1#pragma once
2
3#include "CK_UE.h"
4#include "Components/ActorComponent.h"
5#include "Data/UI/UIContext.h"
6#include "Engine/TimerHandle.h"
7#include "InteractionComponent.generated.h"
8
10class UUserWidgetBase;
11
13
14
16UCLASS(ClassGroup = (Interaction), meta = (BlueprintSpawnableComponent))
17class CK_UE_API UInteractionComponent : public UActorComponent
18{
19 GENERATED_BODY()
20
21public:
24
25public:
27 UFUNCTION(BlueprintCallable, Category = "Interaction")
28 bool TryInteract();
29
30protected:
31 virtual void BeginPlay() override;
32 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
33
34private:
36 AInputResponsive* FindInteractionTarget() const;
37
39 void UpdateInteractionTarget();
40
42 void SetInteractionTarget(AInputResponsive* NewTarget);
43
45 void HandleInteractionFocusEntered(AInputResponsive* Target);
46
48 void HandleInteractionFocusExited(AInputResponsive* Target);
49
51 UFUNCTION()
52 void HandleTargetEndPlay(AActor* Actor, EEndPlayReason::Type EndPlayReason);
53
54public:
56 UFUNCTION(BlueprintPure, Category = "Interaction")
57 AInputResponsive* GetInteractionTarget() const;
58
60 UPROPERTY(BlueprintAssignable, Category = "Interaction")
61 FOnInteractionFocusChanged OnInteractionFocusEntered;
62
64 UPROPERTY(BlueprintAssignable, Category = "Interaction")
65 FOnInteractionFocusChanged OnInteractionFocusExited;
66
67protected:
69 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction", meta = (ClampMin = "0.0", Units = "cm"))
70 float TraceDistance = 5000.0f;
71
72private:
73 TWeakObjectPtr<AInputResponsive> InteractionTarget;
74 TWeakObjectPtr<UUserWidgetBase> ActiveInteractionWidget;
75 FTimerHandle InteractionUpdateTimer;
76};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnInteractionFocusChanged, AInputResponsive *, Target)
Definition InputResponsive.h:16
Definition InteractionComponent.h:18
Definition UserWidgetBase.h:35