Make the damage window more generic

The goal was to handle gameplay event other than damage, such as heals. Renamed it to metric.
This commit is contained in:
Arnaud Jamin
2023-10-03 01:00:06 -04:00
parent 82dca91a89
commit 60b1578e96
11 changed files with 434 additions and 415 deletions
@@ -1,46 +0,0 @@
#pragma once
#include "CoreMinimal.h"
#include "CogInterfaceDamageActor.generated.h"
//--------------------------------------------------------------------------------------------------------------------------
UENUM(BlueprintType)
enum class ECogInterfaceDamageEventType : uint8
{
DamageDealt,
DamageReceived,
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogInterfaceDamageParams
{
GENERATED_BODY()
ECogInterfaceDamageEventType Type;
TObjectPtr<AActor> DamageDealer;
TObjectPtr<AActor> DamageReceiver;
float MitigatedDamage = 0;
float IncomingDamage = 0;
bool IsCritical = false;
};
//--------------------------------------------------------------------------------------------------------------------------
DECLARE_MULTICAST_DELEGATE_OneParam(FCogInterfaceOnDamageEvent, const FCogInterfaceDamageParams&);
//--------------------------------------------------------------------------------------------------------------------------
UINTERFACE(MinimalAPI, Blueprintable)
class UCogInterfaceDamageActor : public UInterface
{
GENERATED_BODY()
};
//--------------------------------------------------------------------------------------------------------------------------
class ICogInterfaceDamageActor
{
GENERATED_BODY()
public:
virtual FCogInterfaceOnDamageEvent& OnDamageEvent() = 0;
};
@@ -0,0 +1,38 @@
#pragma once
#include "CoreMinimal.h"
#include "CogInterfaceMetricActor.generated.h"
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogInterfaceMetricEventParams
{
GENERATED_BODY()
FName Name;
float MitigatedValue = 0;
float UnmitigatedValue = 0;
bool IsCritical = false;
};
//--------------------------------------------------------------------------------------------------------------------------
DECLARE_MULTICAST_DELEGATE_OneParam(FCogInterfaceOnMetricEvent, const FCogInterfaceMetricEventParams&);
//--------------------------------------------------------------------------------------------------------------------------
UINTERFACE(MinimalAPI, Blueprintable)
class UCogInterfaceMetricActor : public UInterface
{
GENERATED_BODY()
};
//--------------------------------------------------------------------------------------------------------------------------
class ICogInterfaceMetricActor
{
GENERATED_BODY()
public:
virtual FCogInterfaceOnMetricEvent& OnMetricEvent() = 0;
};