Hello,
When I’m trying to compile my project an error :
Error C2084 function 'void IIDamageable::DamageResult(int32)' already has a body
pops up
My .h:
#pragma once
#include "Object.h"
#include "IDamageable.generated.h"
/**
*
*/
UINTERFACE(MinimalAPI)
class UIDamageable : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class IIDamageable
{
GENERATED_IINTERFACE_BODY()
virtual void TakeDamage(int32 Damage);
virtual int32& GetMaxHealth() = 0;
virtual int32& GetCurrentHealth() = 0;
UFUNCTION(BlueprintImplementableEvent, Category = "Character")
void DamageResult(int32 cHealth);
};
and .cpp
#include "Project.h"
#include "IDamageable.h"
#include "Engine.h"
UIDamageable::UIDamageable(const class FObjectInitializer& ObjectInitializer)
: UInterface(ObjectInitializer)
{
}
void IIDamageable::TakeDamage(int32 Damage)
{
GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Red, "Base class error");
}
void IIDamageable::DamageResult(int32 cHealth)
{
GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Red, "Base class error");
}