Added event when health is increased
This commit is contained in:
parent
d0e1d8cf39
commit
5b2743ab2f
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
Binary file not shown.
@ -31,6 +31,13 @@ void ULMHealthComponent::RegisterHitBoxes()
|
||||
}
|
||||
}
|
||||
|
||||
void ULMHealthComponent::AddHealth(const float AddedHealth, const bool NoLimits)
|
||||
{
|
||||
Health = FMath::Clamp(Health + AddedHealth, 0.0f, NoLimits ? INT_MAX : MaxHealth);
|
||||
OnHealthChanged.Broadcast(Health, AddedHealth);
|
||||
}
|
||||
|
||||
|
||||
void ULMHealthComponent::TakeDamage_Implementation(const float Damage)
|
||||
{
|
||||
if (Damage <= 0.0f)
|
||||
|
@ -296,7 +296,7 @@ void ALMPlayer::DoLedgeGrabCheck()
|
||||
if (Results)
|
||||
{
|
||||
FHitResult CapsuleCheck;
|
||||
float HalfHeight = LegumixMovementComponent->bWantsToCrouch ? LegumixMovementComponent->CrouchedHalfHeight : GetCapsuleComponent()->GetScaledCapsuleHalfHeight();
|
||||
float HalfHeight = LegumixMovementComponent->bWantsToCrouch ? LegumixMovementComponent->GetCrouchedHalfHeight() : GetCapsuleComponent()->GetScaledCapsuleHalfHeight();
|
||||
const FVector Offset = Hit.ImpactPoint + FVector(0, 0, HalfHeight + GetCapsuleComponent()->GetScaledCapsuleRadius());
|
||||
|
||||
const bool IsObstructed = UKismetSystemLibrary::CapsuleTraceSingleByProfile(GetWorld(), Offset, Offset,
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
* @param NoLimits If sets, ignore the component's MaxHealth value.
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category=Legumix, meta=(Keywords = "Refill, Health"))
|
||||
void AddHealth(const float AddedHealth, const bool NoLimits = false) { Health = FMath::Clamp(Health + AddedHealth, 0.0f, NoLimits ? INT_MAX : MaxHealth); }
|
||||
void AddHealth(const float AddedHealth, const bool NoLimits = false);
|
||||
|
||||
/**
|
||||
* Event automatically called when the character receives damages from an attack source.
|
||||
|
Reference in New Issue
Block a user