fixing things
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -66,3 +66,23 @@ void UHealthAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCall
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UHealthAttributeSet::PostAttributeChange(const FGameplayAttribute& Attribute, float OldValue, float NewValue)
|
||||||
|
{
|
||||||
|
Super::PostAttributeChange(Attribute, OldValue, NewValue);
|
||||||
|
if (Attribute == GetHealthAttribute())
|
||||||
|
{
|
||||||
|
const float ClampedHealth = FMath::Clamp(NewValue, 0.0f, GetMaxHealth());
|
||||||
|
if (ClampedHealth != NewValue)
|
||||||
|
{
|
||||||
|
SetHealth(ClampedHealth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Attribute == GetMaxHealthAttribute())
|
||||||
|
{
|
||||||
|
const float ClampedMaxHealth = FMath::Max(1.0f, NewValue);
|
||||||
|
if (ClampedMaxHealth != NewValue)
|
||||||
|
{
|
||||||
|
SetMaxHealth(ClampedMaxHealth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,8 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FAttributeChangedEvent, UAttributeSet*, AttributeSet, float, OldValue,
|
||||||
|
float, NewValue);
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class ELISTRIA_CALLING_API UHealthAttributeSet : public UElistriaAttributeSetBase
|
class ELISTRIA_CALLING_API UHealthAttributeSet : public UElistriaAttributeSetBase
|
||||||
{
|
{
|
||||||
@@ -24,6 +25,10 @@ public:
|
|||||||
|
|
||||||
virtual void PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) override;
|
virtual void PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
virtual void PostAttributeChange(const FGameplayAttribute& Attribute, float OldValue, float NewValue) override;
|
||||||
|
|
||||||
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
||||||
|
|
||||||
UPROPERTY(VisibleAnywhere,BlueprintReadOnly,ReplicatedUsing=OnRep_Health)
|
UPROPERTY(VisibleAnywhere,BlueprintReadOnly,ReplicatedUsing=OnRep_Health)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FAttributeChangedEvent, UAttributeSet*, AttributeSet, float, OldValue, float, NewValue);
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class ELISTRIA_CALLING_API ULevelAttributeSet : public UElistriaAttributeSetBase
|
class ELISTRIA_CALLING_API ULevelAttributeSet : public UElistriaAttributeSetBase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FAttributeChangedEvent, UAttributeSet*, AttributeSet, float, OldValue, float, NewValue);
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class ELISTRIA_CALLING_API UStaminaAttributeSet : public UElistriaAttributeSetBase
|
class ELISTRIA_CALLING_API UStaminaAttributeSet : public UElistriaAttributeSetBase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
|
GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
|
||||||
GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
|
GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
|
||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FAttributeChangedEvent, UAttributeSet*, AttributeSet, float, OldValue, float, NewValue);
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class ELISTRIA_CALLING_API UElistriaAttributeSetBase : public UAttributeSet
|
class ELISTRIA_CALLING_API UElistriaAttributeSetBase : public UAttributeSet
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user