Space Plunder
Loading...
Searching...
No Matches
ALSDebugComponent.h
Go to the documentation of this file.
1// Copyright: Copyright (C) 2022 Doğa Can Yanıkoğlu
2// Source Code: https://github.com/dyanikoglu/ALS-Community
3
4#pragma once
5
6#include "CoreMinimal.h"
7
8#include "Kismet/KismetSystemLibrary.h"
9#include "Components/ActorComponent.h"
10#include "ALSDebugComponent.generated.h"
11
13class USkeletalMesh;
14
15UCLASS(Blueprintable, BlueprintType)
16class ALSV4_CPP_API UALSDebugComponent : public UActorComponent
17{
18 GENERATED_BODY()
19
20public:
22
23 virtual void BeginPlay() override;
24
25 UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "ALS|Debug")
26 void OnPlayerControllerInitialized(APlayerController* Controller);
27
28 virtual void TickComponent(float DeltaTime, ELevelTick TickType,
29 FActorComponentTickFunction* ThisTickFunction) override;
30
31 virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
32
34 UFUNCTION(BlueprintImplementableEvent, Category = "ALS|Debug")
35 void UpdateColoringSystem();
36
38 UFUNCTION(BlueprintImplementableEvent, Category = "ALS|Debug")
39 void DrawDebugSpheres();
40
42 UFUNCTION(BlueprintImplementableEvent, Category = "ALS|Debug")
43 void SetResetColors();
44
46 UFUNCTION(BlueprintImplementableEvent, Category = "ALS|Debug")
47 void SetDynamicMaterials();
48
49 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
50 void ToggleGlobalTimeDilationLocal(float TimeDilation);
51
52 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
53 void ToggleSlomo();
54
55 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
56 void ToggleHud() { bShowHud = !bShowHud; }
57
58 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
59 void ToggleDebugView();
60
61 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "ALS|Debug")
62 void OpenOverlayMenu(bool bValue);
63
64 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "ALS|Debug")
65 void OverlayMenuCycle(bool bValue);
66
67 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
68 void ToggleDebugMesh();
69
70 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
71 void ToggleTraces() { bShowTraces = !bShowTraces; }
72
73 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
74 void ToggleDebugShapes() { bShowDebugShapes = !bShowDebugShapes; }
75
76 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
77 void ToggleLayerColors() { bShowLayerColors = !bShowLayerColors; }
78
79 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
80 void ToggleCharacterInfo() { bShowCharacterInfo = !bShowCharacterInfo; }
81
82 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
83 bool GetDebugView() { return bDebugView; }
84
85 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
86 bool GetShowTraces() { return bShowTraces; }
87
88 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
89 bool GetShowDebugShapes() { return bShowDebugShapes; }
90
91 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
92 bool GetShowLayerColors() { return bShowLayerColors; }
93
94 UFUNCTION(BlueprintCallable, Category = "ALS|Debug")
95 void FocusedDebugCharacterCycle(bool bValue);
96
97 // utility functions to draw trace debug shapes,
98 // which are derived from Engine/Private/KismetTraceUtils.h.
99 // Sadly the functions are private, which was the reason
100 // why there reimplemented here.
101 static void DrawDebugLineTraceSingle(const UWorld* World,
102 const FVector& Start,
103 const FVector& End,
104 EDrawDebugTrace::Type DrawDebugType,
105 bool bHit,
106 const FHitResult& OutHit,
107 FLinearColor TraceColor,
108 FLinearColor TraceHitColor,
109 float DrawTime);
110
111 static void DrawDebugCapsuleTraceSingle(const UWorld* World,
112 const FVector& Start,
113 const FVector& End,
114 const FCollisionShape& CollisionShape,
115 EDrawDebugTrace::Type DrawDebugType,
116 bool bHit,
117 const FHitResult& OutHit,
118 FLinearColor TraceColor,
119 FLinearColor TraceHitColor,
120 float DrawTime);
121
122 static void DrawDebugSphereTraceSingle(const UWorld* World,
123 const FVector& Start,
124 const FVector& End,
125 const FCollisionShape& CollisionShape,
126 EDrawDebugTrace::Type DrawDebugType,
127 bool bHit,
128 const FHitResult& OutHit,
129 FLinearColor TraceColor,
130 FLinearColor TraceHitColor,
131 float DrawTime);
132
133protected:
134 void DetectDebuggableCharactersInWorld();
135
136public:
137 UPROPERTY(BlueprintReadOnly, Category = "ALS|Debug")
138 TObjectPtr<AALSBaseCharacter> OwnerCharacter;
139
140 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ALS|Debug")
141 bool bSlomo = false;
142
143 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ALS|Debug")
144 bool bShowHud = false;
145
146 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ALS|Debug")
147 bool bShowCharacterInfo = false;
148
149 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ALS|Debug")
150 TObjectPtr<USkeletalMesh> DebugSkeletalMesh = nullptr;
151
152 UPROPERTY(BlueprintReadOnly, Category = "ALS|Debug")
153 TArray<TObjectPtr<AALSBaseCharacter>> AvailableDebugCharacters;
154
155 UPROPERTY(BlueprintReadOnly, Category = "ALS|Debug")
156 TObjectPtr<AALSBaseCharacter> DebugFocusCharacter = nullptr;
157private:
158 static bool bDebugView;
159
160 static bool bShowTraces;
161
162 static bool bShowDebugShapes;
163
164 static bool bShowLayerColors;
165
166 bool bNeedsColorReset = false;
167
168 bool bDebugMeshVisible = false;
169
170 UPROPERTY()
171 TObjectPtr<USkeletalMesh> DefaultSkeletalMesh = nullptr;
172
175 int32 FocusedDebugCharacterIndex = INDEX_NONE;
176};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
Definition ALSBaseCharacter.h:38
Definition ALSDebugComponent.h:17