UE5/Damage
[UE5] json으로 레벨별 데미지 구현
Mini_96
2024. 6. 23. 03:18
* 태그에 맞는 수정자값 설정
- 태그추가
struct FAuraGameplayTags
{
public:
...
FGameplayTag Damage;
void FAuraGameplayTags::InitializeNativeGameplayTags()
{
...
GameplayTags.Damage = UGameplayTagsManager::Get().AddNativeGameplayTag(
FName("Damage"),
FString("Damage")
);
- 태그에맞는, 수정자설정
void UAuraProjectileSpell::SpawnProjectile(const FVector& ProjectileTargetLocation)
{
...
//GE_Damage에 사용할 Caller 설정
FAuraGameplayTags GameplayTags = FAuraGameplayTags::Get();
UAbilitySystemBlueprintLibrary::AssignTagSetByCallerMagnitude(SpecHandle, GameplayTags.Damage, 50.f);
* 하드코딩해결
모든GA가 데미지를가지고, 커브테이블로 이를 구현하면됨
UCLASS()
class AURA_API UAuraGameplayAbility : public UGameplayAbility
{
...
UPROPERTY(EditDefaultsOnly,BlueprintReadOnly, Category="Damage")
FScalableFloat Damage;
json 만들고
[
{
"Name": "Abilities.Firebolt",
"1": 5,
"5": 10,
"10": 16,
"15": 27,
"20": 41,
"40": 120
}
]
import 하고
* 설정된 damage값을 get하는 방법? => 하드코딩대신 사용
void UAuraProjectileSpell::SpawnProjectile(const FVector& ProjectileTargetLocation)
{
const float ScaledDamage = Damage.GetValueAtLevel(GetAbilityLevel()); //현레벨에 맞는 데미지를 얻어옴 (json으로 설정한그값)
UAbilitySystemBlueprintLibrary::AssignTagSetByCallerMagnitude(SpecHandle, GameplayTags.Damage, ScaledDamage);
feat : json으로 레벨별 데미지 구현 · DongHoonYu96/GameplayAbilitySystem_Aura@d7edc47
Bisu96 committed Jun 22, 2024
github.com