This repository has been archived on 2025-04-18. You can view files and clone it, but cannot push or open issues or pull requests.

47 lines
1.4 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "LMBulletInfo.h"
#include "Components/CapsuleComponent.h"
#include "LMHitBox.generated.h"
UCLASS(Blueprintable, ClassGroup=(Legumix), meta=(BlueprintSpawnableComponent))
class LEGUMEMIX_API ULMHitBox : public UCapsuleComponent
{
GENERATED_BODY()
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FHitBoxHitSignature, ULMHitBox*, HitBox, float, Damage);
public:
ULMHitBox();
void OnHit(const FLMBulletInfo& BulletInfo);
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category=Legumix)
float CalculateDamage(float Damage, float Distance, UCurveFloat* Falloff, float MaxDistance);
public:
/** Delegate called when the hitbox is hit.
* @param HitBox: The Hitbox that was hit.
* @param Damage: The amount of damage done to the hitbox.
*/
UPROPERTY(BlueprintAssignable, BlueprintCallable)
FHitBoxHitSignature OnHitBoxHit;
private:
/**
* A value to multiply the damage received by.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
float DamageModifier = 1.0f;
/**
* The Amount of damage removed when hit.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true, ClampMin=0.0f, UIMin=0.0f))
float FlatDamageAbsorption = 0.f;
};