Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
UTargetingComponent 클래스 참조

#include <TargetingComponent.h>

UTargetingComponent에 대한 상속 다이어그램 :
Inheritance graph
UTargetingComponent에 대한 협력 다이어그램:
Collaboration graph

Public 멤버 함수

 UTargetingComponent ()
 
void SetHardLockTarget (ITargetableInterface *NewTarget)
 
void ResetHardLockTarget ()
 
void ClearHardLockTarget ()
 
ITargetableInterface * FindClosestTarget (float MaxRange) const
 
TArray< ITargetableInterface * > FindTargetsInRange (float MaxRange) const
 
ITargetableInterface * FindNearestTargetByDirection (const FVector &Origin, const FVector &Direction, float MaxRange) const
 
void SetSoftLockTarget (ITargetableInterface *Result)
 
void ResetSoftLockTarget ()
 
ITargetableInterface * AcquireLockTarget (const FVector &Direction, float MaxRange)
 
bool HasHardLockTarget () const
 
TScriptInterface< ITargetableInterface > GetHardLockTarget () const
 
TScriptInterface< ITargetableInterface > GetSoftLockTarget () const
 
FORCEINLINE ITargetableInterface * GetHardLockTargetable () const
 
AActor * GetCurrentTargetActor () const
 

Public 속성

FOnHardLockTargetChangedSignature OnHardLockTargetChanged
 

Private 속성

TScriptInterface< ITargetableInterface > HardLockTarget
 
TWeakObjectPtr< AActor > SoftLockTargetActor
 
bool bSoftLockActive = false
 

생성자 & 소멸자 문서화

◆ UTargetingComponent()

UTargetingComponent::UTargetingComponent ( )
15{
16 PrimaryComponentTick.bCanEverTick = false;
17}

멤버 함수 문서화

◆ AcquireLockTarget()

ITargetableInterface * UTargetingComponent::AcquireLockTarget ( const FVector &  Direction,
float  MaxRange 
)
138{
139 if (bSoftLockActive && SoftLockTargetActor.IsValid())
140 {
142
143 if (LockedTargetable && LockedTargetable->IsTargetValid() && LockedTargetable->IsTargetable())
144 {
145 return LockedTargetable;
146 }
147 }
148
149 bSoftLockActive = false;
150 SoftLockTargetActor.Reset();
151
152 const AActor* Owner = GetOwner();
153 const FVector Origin = Owner ? Owner->GetActorLocation() : FVector::ZeroVector;
154
155 ITargetableInterface* Targetable = FindNearestTargetByDirection(Origin, Direction, MaxRange);
157 return Targetable;
158}
Definition TargetableInterface.h:20
virtual bool IsTargetable() const =0
virtual bool IsTargetValid() const
Definition TargetableInterface.cpp:123
static ITargetableInterface * From(TObjectPtr< T > Object)
Definition TargetableInterface.h:53
bool bSoftLockActive
Definition TargetingComponent.h:72
void SetSoftLockTarget(ITargetableInterface *Result)
Definition TargetingComponent.cpp:118
TWeakObjectPtr< AActor > SoftLockTargetActor
Definition TargetingComponent.h:71
ITargetableInterface * FindNearestTargetByDirection(const FVector &Origin, const FVector &Direction, float MaxRange) const
Definition TargetingComponent.cpp:97

다음을 참조함 : bSoftLockActive, FindNearestTargetByDirection(), ITargetableInterface::From(), ITargetableInterface::IsTargetable(), ITargetableInterface::IsTargetValid(), SetSoftLockTarget(), SoftLockTargetActor, Targetable.

다음에 의해서 참조됨 : UPlayerMotionWarpingComponent::FindWarpTargetLocation().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ClearHardLockTarget()

void UTargetingComponent::ClearHardLockTarget ( )
52{
53 if (!HardLockTarget)
54 {
55 return;
56 }
57
58 HardLockTarget.SetObject(nullptr);
59 OnHardLockTargetChanged.Broadcast(nullptr);
60}
FOnHardLockTargetChangedSignature OnHardLockTargetChanged
Definition TargetingComponent.h:38
TScriptInterface< ITargetableInterface > HardLockTarget
Definition TargetingComponent.h:68

다음을 참조함 : HardLockTarget, OnHardLockTargetChanged.

◆ FindClosestTarget()

ITargetableInterface * UTargetingComponent::FindClosestTarget ( float  MaxRange) const
64{
65 UStageSubsystem* StageSubsystem = GetWorld() ? GetWorld()->GetSubsystem<UStageSubsystem>() : nullptr;
66
67 if (StageSubsystem == nullptr)
68 {
69 return nullptr;
70 }
71
72 return StageSubsystem->GetStageTargetableQueryHandle().GetContext()
73 .GatherCandidates(MaxRange)
76 .GetTarget();
77}
Definition StageSubsystem.h:102
TargetableQuery GetStageTargetableQueryHandle() const
Definition StageSubsystem.cpp:236
TargetableQueryContext & GatherCandidates(float MaxLockOnDistance)
Definition TargetableQuery.cpp:10
TargetableQueryContext & FilterByLineOfSight()
Definition TargetableQuery.cpp:234
TargetableQueryContext & PickClosestFromCenter()
Definition TargetableQuery.cpp:52
ITargetableInterface * GetTarget(const int32 Index=0)
Definition TargetableQuery.h:44
TargetableQueryContext GetContext() const
Definition TargetableQuery.h:102

다음을 참조함 : TargetableQueryContext::FilterByLineOfSight(), TargetableQueryContext::GatherCandidates(), TargetableQuery::GetContext(), UStageSubsystem::GetStageTargetableQueryHandle(), TargetableQueryContext::GetTarget(), TargetableQueryContext::PickClosestFromCenter().

다음에 의해서 참조됨 : UCameraTargetingComponent::BeginTargeting(), GetSoftLockTarget(), UCameraTargetingComponent::UpdateCameraBehavior().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ FindNearestTargetByDirection()

ITargetableInterface * UTargetingComponent::FindNearestTargetByDirection ( const FVector &  Origin,
const FVector &  Direction,
float  MaxRange 
) const
98{
99 UStageSubsystem* StageSubsystem = GetWorld() ? GetWorld()->GetSubsystem<UStageSubsystem>() : nullptr;
100
101 if (StageSubsystem == nullptr)
102 {
103 LOG_ERROR(LogCK, "%s을 가져올 수 없습니다. ", NAMEOF(UStageSubsystem));
104 return nullptr;
105 }
106
107 TargetableQueryContext Context = StageSubsystem->GetStageTargetableQueryHandle().GetContext(); //하하 난 체이닝 메서드가 좋아.
108 return Context.FindDirectionNearestEnemy(Origin, Direction, MaxRange)
109 .CacheResult()
110 .GetTarget()
111 ? Context.GetCachedTarget()
112 : Context.ResetCachedResult()
113 .FindDistanceNearestEnemy(Origin, MaxRange)
114 .GetTarget();
115}
#define LOG_ERROR(Category, Format,...)
Definition CK_UE.h:41
#define NAMEOF(Type)
Definition CK_UE.h:31
Definition TargetableQuery.h:7
TargetableQueryContext & FindDistanceNearestEnemy(const FVector &Origin, float MaxRange)
Definition TargetableQuery.cpp:164
TargetableQueryContext & FindDirectionNearestEnemy(const FVector &Origin, const FVector &Direction, float MaxRange)
Definition TargetableQuery.cpp:113
TargetableQueryContext & CacheResult()
Definition TargetableQuery.cpp:227
TargetableQueryContext & ResetCachedResult()
Definition TargetableQuery.cpp:219
ITargetableInterface * GetCachedTarget(const int32 Index=0)
Definition TargetableQuery.h:64

다음을 참조함 : TargetableQueryContext::CacheResult(), TargetableQueryContext::FindDirectionNearestEnemy(), TargetableQueryContext::FindDistanceNearestEnemy(), TargetableQueryContext::GetCachedTarget(), TargetableQuery::GetContext(), UStageSubsystem::GetStageTargetableQueryHandle(), TargetableQueryContext::GetTarget(), LOG_ERROR, NAMEOF, TargetableQueryContext::ResetCachedResult().

다음에 의해서 참조됨 : AcquireLockTarget().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ FindTargetsInRange()

TArray< ITargetableInterface * > UTargetingComponent::FindTargetsInRange ( float  MaxRange) const
81{
82 UStageSubsystem* StageSubsystem = GetWorld() ? GetWorld()->GetSubsystem<UStageSubsystem>() : nullptr;
83
84 if (StageSubsystem == nullptr)
85 {
86 return TArray<ITargetableInterface*>();
87 }
88
89 return StageSubsystem->GetStageTargetableQueryHandle()
90 .GetContext()
91 .GatherCandidates(MaxRange)
93 .GetTargets();
94}
TArray< ITargetableInterface * > GetTargets(const int32 StartIdx, const int32 EndIdx)
Definition TargetableQuery.h:29

다음을 참조함 : TargetableQueryContext::FilterByLineOfSight(), TargetableQueryContext::GatherCandidates(), TargetableQuery::GetContext(), UStageSubsystem::GetStageTargetableQueryHandle(), TargetableQueryContext::GetTargets().

다음에 의해서 참조됨 : UCameraTargetingComponent::CycleTarget(), UCameraTargetingComponent::FindVisibleTargetingMarkerTargets().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetCurrentTargetActor()

AActor * UTargetingComponent::GetCurrentTargetActor ( ) const

새 검색 없이 현재 하드 락, 저장된 소프트 락 순서로 타겟 액터를 반환한다.

195{
196 if (HasHardLockTarget())
197 {
198 return ITargetableInterface::AsActor(HardLockTarget.GetInterface());
199 }
200
201 if (bSoftLockActive && SoftLockTargetActor.IsValid())
202 {
203 return SoftLockTargetActor.Get();
204 }
205 else
206 {
207 return nullptr;
208 }
209}
static AActor * AsActor(ITargetableInterface *Interface)
Definition TargetableInterface.cpp:24
bool HasHardLockTarget() const
Definition TargetingComponent.cpp:161

다음을 참조함 : ITargetableInterface::AsActor(), bSoftLockActive, HardLockTarget, HasHardLockTarget(), SoftLockTargetActor.

다음에 의해서 참조됨 : UAnimNotifyState_RotateToTarget::ResolveRotationTarget().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetHardLockTarget()

TScriptInterface< ITargetableInterface > UTargetingComponent::GetHardLockTarget ( ) const
168{
169 return HardLockTarget;
170}

다음을 참조함 : HardLockTarget.

다음에 의해서 참조됨 : UCameraTargetingComponent::GetCurrentTarget().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetHardLockTargetable()

FORCEINLINE ITargetableInterface * UTargetingComponent::GetHardLockTargetable ( ) const
inline
58 {
59 return HardLockTarget.GetInterface();
60 }

다음에 의해서 참조됨 : UCameraTargetingComponent::CycleTarget(), UCameraTargetingComponent::GetTargetable(), UCameraTargetingComponent::IsTargeting(), UCameraTargetingComponent::UpdateCameraBehavior().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetSoftLockTarget()

TScriptInterface< ITargetableInterface > UTargetingComponent::GetSoftLockTarget ( ) const
174{
175 if (bSoftLockActive && SoftLockTargetActor.IsValid())
176 {
177 return SoftLockTargetActor.Get();
178 }
179
180 const AMainPlayerCharacter* Player = Cast<AMainPlayerCharacter>(GetOwner());
181 const UWeaponLoadoutComponent* WeaponLoadoutComponent = Player->GetWeaponLoadoutComponent();
182
183 if (WeaponLoadoutComponent == nullptr)
184 {
185 return nullptr;
186 }
187
188 const UWeaponDefinition* CurrentWeaponDefinition = WeaponLoadoutComponent->GetCurrentDefinition();
189 TScriptInterface<ITargetableInterface> Result = ITargetableInterface::AsActor(FindClosestTarget(CurrentWeaponDefinition->AttackRange));
190 return Result;
191}
Definition MainPlayerCharacter.h:43
ITargetableInterface * FindClosestTarget(float MaxRange) const
Definition TargetingComponent.cpp:63
Definition WeaponDefinition.h:77
float AttackRange
Definition WeaponDefinition.h:119
Definition WeaponLoadoutComponent.h:20
FORCEINLINE UWeaponDefinition * GetCurrentDefinition() const
Definition WeaponLoadoutComponent.h:44

다음을 참조함 : ITargetableInterface::AsActor(), UWeaponDefinition::AttackRange, bSoftLockActive, FindClosestTarget(), UWeaponLoadoutComponent::GetCurrentDefinition(), Player, SoftLockTargetActor.

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ HasHardLockTarget()

bool UTargetingComponent::HasHardLockTarget ( ) const
162{
163 return HardLockTarget || HardLockTarget.GetObject() || HardLockTarget.GetInterface();
164}

다음을 참조함 : HardLockTarget.

다음에 의해서 참조됨 : GetCurrentTargetActor(), UCameraTargetingComponent::HasTarget().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ResetHardLockTarget()

void UTargetingComponent::ResetHardLockTarget ( )
41{
42 if (ITargetableInterface* Targetable = Cast<ITargetableInterface>(HardLockTarget.GetObject()))
43 {
44 Targetable->HideLockOnMarker();
45 }
46
47 HardLockTarget = nullptr;
48}

다음을 참조함 : HardLockTarget, Targetable.

◆ ResetSoftLockTarget()

void UTargetingComponent::ResetSoftLockTarget ( )
131{
132 bSoftLockActive = false;
133 SoftLockTargetActor.Reset();
134}

다음을 참조함 : bSoftLockActive, SoftLockTargetActor.

다음에 의해서 참조됨 : UPlayerMotionWarpingComponent::ResetLockOnTarget().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ SetHardLockTarget()

void UTargetingComponent::SetHardLockTarget ( ITargetableInterface *  NewTarget)
21{
22 AActor* NewActor = ITargetableInterface::AsActor(NewTarget);
23
24 if (NewActor == nullptr || HardLockTarget.GetObject() == NewActor)
25 {
26 return;
27 }
28
29 if (ITargetableInterface* OldTarget = HardLockTarget.GetInterface())
30 {
31 OldTarget->HideLockOnMarker();
32 }
33
34 NewTarget->ShowLockOnMarker();
35 HardLockTarget = NewActor;
36 OnHardLockTargetChanged.Broadcast(NewTarget);
37}
virtual void ShowLockOnMarker()=0

다음을 참조함 : ITargetableInterface::AsActor(), HardLockTarget, OnHardLockTargetChanged, ITargetableInterface::ShowLockOnMarker().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ SetSoftLockTarget()

void UTargetingComponent::SetSoftLockTarget ( ITargetableInterface *  Result)
119{
120 if (Result == nullptr)
121 {
122 return;
123 }
124
126 bSoftLockActive = true;
127}

다음을 참조함 : ITargetableInterface::AsActor(), bSoftLockActive, SoftLockTargetActor.

다음에 의해서 참조됨 : AcquireLockTarget().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ bSoftLockActive

bool UTargetingComponent::bSoftLockActive = false
private

◆ HardLockTarget

TScriptInterface<ITargetableInterface> UTargetingComponent::HardLockTarget
private

◆ OnHardLockTargetChanged

FOnHardLockTargetChangedSignature UTargetingComponent::OnHardLockTargetChanged

다음에 의해서 참조됨 : ClearHardLockTarget(), SetHardLockTarget().

◆ SoftLockTargetActor

TWeakObjectPtr<AActor> UTargetingComponent::SoftLockTargetActor
private

이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: