Space Plunder
Loading...
Searching...
No Matches
GameplayDebuggerCategory_Health.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4#include "Data/HealthData.h"
5
6#if WITH_GAMEPLAY_DEBUGGER
7
8#include "CoreMinimal.h"
9#include "GameplayDebuggerCategory.h"
10
11class AActor;
12class APlayerController;
13
18class FGameplayDebuggerCategory_Health : public FGameplayDebuggerCategory
19{
20
21public:
22 FGameplayDebuggerCategory_Health();
23
24 virtual void CollectData(APlayerController* OwnerPC, AActor* DebugActor) override;
25
26 virtual void CollectHealthData(AActor* SelectedActor);
27 virtual void CollectServerHealthData(APlayerController* OwnerPC);
28
29 virtual void DrawData(APlayerController* OwnerPC, FGameplayDebuggerCanvasContext& CanvasContext) override;
30
31 static TSharedRef<FGameplayDebuggerCategory> MakeInstance();
32
33 void ToggleBodyPartsHealth();
34 void ToggleBodyPartsHighlight();
35
36
37 // Show HealthBar
38 //
39
40 struct FDebugBodyPart
41 {
42 FString PartName;
43 FName StartBone;
44 FName EndBone;
45 // TArray<FName> Bones;
46 float CurrentPartHealth;
47
48 FDebugBodyPart()
49 {
50
51 }
52 FDebugBodyPart(const FString& Name, const FName& Start, const FName& End, const float CurrentHealth)
53 {
54 PartName = Name;
55 StartBone = Start;
56 EndBone = End;
57 CurrentPartHealth = CurrentHealth;
58 }
59 friend FArchive& operator<<(FArchive& Ar, FDebugBodyPart& BodyPart);
60
61 bool operator==(const FDebugBodyPart& Other) const
62 {
63 return PartName == Other.PartName;
64 }
65
66 // FArchive& operator<<(FArchive& Ar, FDebugBodyPart& BodyPart)
67 // {
68 // Ar << BodyPart.PartName;
69 // Ar << BodyPart.StartBone;
70 // Ar << BodyPart.EndBone;
71 // Ar << BodyPart.CurrentPartHealth;
72 // return Ar;
73 // }
74 };
75protected:
76 bool GetDrawLocation(const FName& Start, const FName& End, AActor& DebugActor, const FGameplayDebuggerCanvasContext& CanvasContext, const FString& String, float& PosX, float& PosY);
77
78
79 struct FRepData
80 {
81 FString PawnName;
82 float CurrentHealth;
83 float FullHealth;
84 float CurrentShield;
85 float FullShield;
86 bool bCanBeKnockedOut;
87 bool bHasShield;
88 float BodyPartMaxHealth;
89 float BodyPartInjuredHealth;
90
91 TArray<FDebugBodyPart> BodyParts;
92 // Knocked out
93 // KnockOutHealth
94 // KnockOutMaxHealth
95 // KnockOutTimeToWakeUp
96 void Serialize(FArchive& Ar);
97 };
98
99 FRepData DataPack;
100 FRepData ServerDataPack;
101 int32 SelectedBodyPart = 0;
102 bool bShowServerValues = false;
103 bool bDebugActorHasController = false;
104
105};
106
107
108#endif