45 lines
831 B
C++
45 lines
831 B
C++
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
|
|
|
|
|
|
#include "AbilitySystem/GCS_GameplayEffectContext.h"
|
|
|
|
void FGCS_ContextPayload_Combat::SetTaggedValue(const FGameplayTag& Tag, float NewValue)
|
|
{
|
|
if (Tag.IsValid())
|
|
{
|
|
bool bFound = false;
|
|
for (FGCS_TaggedValue& TaggedValue : TaggedValues)
|
|
{
|
|
if (TaggedValue.Attribute == Tag)
|
|
{
|
|
TaggedValue.Value = NewValue;
|
|
bFound = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!bFound)
|
|
{
|
|
FGCS_TaggedValue Temp;
|
|
Temp.Attribute = Tag;
|
|
Temp.Value = NewValue;
|
|
TaggedValues.Add(Temp);
|
|
}
|
|
}
|
|
}
|
|
|
|
float FGCS_ContextPayload_Combat::GetTaggedValue(const FGameplayTag& Tag) const
|
|
{
|
|
if (Tag.IsValid())
|
|
{
|
|
for (const FGCS_TaggedValue& TaggedValue : TaggedValues)
|
|
{
|
|
if (TaggedValue.Attribute == Tag)
|
|
{
|
|
return TaggedValue.Value;
|
|
}
|
|
}
|
|
}
|
|
return 0.0f;
|
|
}
|