RealtimeStyleTransferRuntime/Source/LyraGame/Weapons/LyraDamageLogDebuggerCompon...

51 lines
1.4 KiB
C
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Components/ActorComponent.h"
2022-09-13 07:18:28 +00:00
#include "Containers/Map.h"
#include "Engine/EngineBaseTypes.h"
#include "Engine/EngineTypes.h"
2022-05-23 18:41:30 +00:00
#include "GameFramework/GameplayMessageSubsystem.h"
2022-09-13 07:18:28 +00:00
#include "HAL/Platform.h"
#include "UObject/UObjectGlobals.h"
2022-05-23 18:41:30 +00:00
#include "LyraDamageLogDebuggerComponent.generated.h"
2022-09-13 07:18:28 +00:00
class UObject;
struct FGameplayTag;
2022-05-23 18:41:30 +00:00
struct FLyraVerbMessage;
struct FFrameDamageEntry
{
int32 NumImpacts = 0;
double SumDamage = 0.0;
double TimeOfFirstHit = 0.0;
};
UCLASS(Blueprintable, meta=(BlueprintSpawnableComponent))
class ULyraDamageLogDebuggerComponent : public UActorComponent
{
GENERATED_BODY()
public:
ULyraDamageLogDebuggerComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
UPROPERTY(EditAnywhere)
double SecondsBetweenDamageBeforeLogging = 1.0;
private:
FGameplayMessageListenerHandle ListenerHandle;
double LastDamageEntryTime = 0.0;
TMap<int64, FFrameDamageEntry> DamageLog;
private:
void OnDamageMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload);
};