KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UHookSystem.h
이 파일의 문서화 페이지로 가기
1// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
9#pragma once
10
11#include "CoreMinimal.h"
12#include "Components/ActorComponent.h"
13#include "UHookSystem.generated.h"
14
15class UStaticMeshComponent;
16
18UENUM(BlueprintType)
19enum class EHookState : uint8
20{
21 Idle UMETA(DisplayName = "Idle"),
22 Launching UMETA(DisplayName = "Launching"),
23 Pulling UMETA(DisplayName = "Pulling")
24};
25
31UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
32class ONEPIECE_API UHookSystem : public UActorComponent
33{
34 GENERATED_BODY()
35
36public:
37 UHookSystem();
38
39protected:
40 virtual void BeginPlay() override;
41 virtual void TickComponent(float DeltaTime, ELevelTick TickType,
42 FActorComponentTickFunction* ThisTickFunction) override;
43 virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
44
45public:
48 UFUNCTION(BlueprintCallable, Category = "Hook")
49 void InitSystem(class UStaticMeshComponent* InCableMesh, class UStaticMeshComponent* InProjectileMesh);
50
52 UFUNCTION(BlueprintCallable, Category = "Hook")
53 void TryHook();
54
56 UFUNCTION(BlueprintCallable, Category = "Hook")
57 void StartHook(const FHitResult& Hit);
58
60 UFUNCTION(BlueprintCallable, Category = "Hook")
61 void ReleaseHook();
62
63protected:
65 UFUNCTION(Server, Reliable)
66 void ServerTryHook(const FHitResult& HitResult);
67
69 UFUNCTION(Server, Reliable)
70 void ServerReleaseHook();
71
72public:
73
75 UFUNCTION(BlueprintPure, Category = "Hook")
76 bool IsHooking() const { return HookedTarget != nullptr; }
77
79 UFUNCTION(BlueprintPure, Category = "Hook")
80 bool HasHookTarget() const { return CurHookTarget != nullptr; }
81
82 bool PerformCenterLineTrace(FHitResult& OutHit);
83
84protected:
90 bool PerformServerLineTrace(FHitResult& OutHit);
91
92protected:
94 void DetectHookTarget();
95
97 void UpdateHookTargetUI();
98
100 void UpdateHookLaunching(float DeltaTime);
101
103 void UpdateHookPulling(float DeltaTime);
104
106 void UpdateCable();
107
109 UFUNCTION()
110 void OnRep_HookState();
111
113 UFUNCTION()
114 void OnRep_HookProjectileLocation();
115
116public:
118 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hook|Launch")
119 float LaunchSpeed = 2000.0f;
120
122 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hook|Launch")
123 float MaxHookDistance = 1500.0f;
124
126 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hook|Pull")
127 float HookSpeed = 500.0f;
128
130 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hook|Pull")
131 float DesiredDistance = 100.0f;
132
134 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Interaction")
135 float InteractionDistance = 1200.0f;
136
138 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hook|Pull")
139 float CompleteThreshold = 100.0f;
140
142 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Debug")
143 bool bShowDebugInfo = true;
144
146 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hook|Visual")
147 float CableThickness = 8.0f;
148
149protected:
151 UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_HookState, Category = "Hook")
152 EHookState HookState = EHookState::Idle;
153
155 UPROPERTY(Replicated)
156 TObjectPtr<AActor> HookedTarget;
157
159 UPROPERTY()
160 TObjectPtr<AActor> CurHookTarget;
161
162 UPROPERTY()
163 TObjectPtr<class Aluggage> CurHookTarget_Luggage;
164
170 UPROPERTY()
171 TObjectPtr<class Aluggage> PrevHookTarget_Luggage;
172
173 UPROPERTY()
174 TObjectPtr<class UStaticMeshComponent> CableMesh;
175
176 UPROPERTY()
177 TObjectPtr<class UStaticMeshComponent> ProjectileMesh;
178
180 UPROPERTY(ReplicatedUsing = OnRep_HookProjectileLocation)
181 FVector HookProjectileLocation;
182
184 UPROPERTY(Replicated)
185 FVector HookLaunchDirection;
186
188 UPROPERTY()
189 TObjectPtr<class APlayerActor> OwnerPlayer;
190
192 float CableMeshBaseLength = 100.0f;
193 float CableMeshBaseRadius = 1.0f;
194
196 TEnumAsByte<ECollisionEnabled::Type> OriginalCollisionEnabled;
197
199 void UpdateCableMeshTransform(const FVector& CableStart, const FVector& CableEnd);
200};
EHookState
Hook 상태
Definition UHookSystem.h:20
Main character driven directly by the player.
상호작용 가능한 수하물 액터
Definition luggage.h:15