Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
TargetingComponent.h
이 파일의 문서화 페이지로 가기
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Components/ActorComponent.h"
8#include "TargetingComponent.generated.h"
9
10DECLARE_MULTICAST_DELEGATE_OneParam(FOnHardLockTargetChangedSignature, ITargetableInterface* /*NewTarget*/);
11
12
13UENUM()
14enum class ETargetingMode : uint8
15{
16 SoftTargeting UMETA(DisplayName = "소프트 타겟팅", ToolTip = "상호작용(공격도 포함) 범위 안에 들어있는 대상"),
17 HardTargeting UMETA(DisplayName = "하드 하겟팅", ToolTip = "유저 입력으로 UI와 카메라 방향 고정으로 지목된 대상")
18};
19
20
21UCLASS(ClassGroup=(Combat), meta=(BlueprintSpawnableComponent))
22class CK_UE_API UTargetingComponent : public UActorComponent
23{
24 GENERATED_BODY()
25
26public:
28
29public:
30 void SetHardLockTarget(ITargetableInterface* NewTarget);
31 void ResetHardLockTarget();
32 void ClearHardLockTarget();
33
34 ITargetableInterface* FindClosestTarget(float MaxRange) const;
35 TArray<ITargetableInterface*> FindTargetsInRange(float MaxRange) const;
36 ITargetableInterface* FindNearestTargetByDirection(const FVector& Origin, const FVector& Direction, float MaxRange) const;
37
38 FOnHardLockTargetChangedSignature OnHardLockTargetChanged;
39
40 // --- 암시적 타겟 (Soft Lock) : 사거리 내 자동 판정, 카메라 고정 없음 (모션 워핑용) ---
41 void SetSoftLockTarget(ITargetableInterface* Result);
42 void ResetSoftLockTarget();
43 ITargetableInterface* AcquireLockTarget(const FVector& Direction, float MaxRange);
44
45public:
46 // --- 명시적 타겟 (Hard Lock) : 입력으로 고정, 카메라 방향까지 함께 고정 ---
47 UFUNCTION(BlueprintPure, Category = "Targeting")
48 bool HasHardLockTarget() const;
49
50 UFUNCTION(BlueprintPure, Category = "Targeting")
51 TScriptInterface<ITargetableInterface> GetHardLockTarget() const;
52
53 UFUNCTION(BlueprintPure, Category = "Targeting")
54 TScriptInterface<ITargetableInterface> GetSoftLockTarget() const;
55
56public:
57 FORCEINLINE ITargetableInterface* GetHardLockTargetable() const
58 {
59 return HardLockTarget.GetInterface();
60 }
61
62public:
64 AActor* GetCurrentTargetActor() const;
65
66private:
67 UPROPERTY()
68 TScriptInterface<ITargetableInterface> HardLockTarget;
69
70private:
71 TWeakObjectPtr<AActor> SoftLockTargetActor;
72 bool bSoftLockActive = false;
73};
DECLARE_MULTICAST_DELEGATE_OneParam(FOnHardLockTargetChangedSignature, ITargetableInterface *)
ETargetingMode
Definition TargetingComponent.h:15
Definition TargetableInterface.h:20
Definition TargetingComponent.h:23
FOnHardLockTargetChangedSignature OnHardLockTargetChanged
Definition TargetingComponent.h:38