Starting to figure out attribute set more (Part of 65. 65. Initialize Attributes from a Data Table)
Going to move gasagen code to editor module.
This commit is contained in:
@ -64,6 +64,18 @@ AGasaCharacter::AGasaCharacter()
|
||||
ACharacter::SetReplicateMovement(true);
|
||||
}
|
||||
|
||||
#pragma region Ability System
|
||||
void AGasaCharacter::InitDefaultAttributes()
|
||||
{
|
||||
UAbilitySystemComponent* ASC = GetAbilitySystemComponent();
|
||||
ensure(ASC);
|
||||
ensure(DefaultAttributes);
|
||||
FGameplayEffectContextHandle Context = ASC->MakeEffectContext();
|
||||
FGameplayEffectSpecHandle Spec = ASC->MakeOutgoingSpec(DefaultAttributes, 1.0f, Context );
|
||||
ASC->ApplyGameplayEffectSpecToTarget( * Spec.Data, ASC );
|
||||
}
|
||||
#pragma endregion Ability System
|
||||
|
||||
#pragma region GameFramework
|
||||
void AGasaCharacter::Controller_OnPawnPossessed()
|
||||
{
|
||||
@ -186,6 +198,8 @@ void AGasaCharacter::BeginPlay()
|
||||
{
|
||||
AbilitySystem->InitAbilityActorInfo(this, this);
|
||||
Cast<UGasaAbilitySystemComp>(AbilitySystem)->OnAbilityActorInfoSet();
|
||||
|
||||
InitDefaultAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,3 +247,4 @@ void AGasaCharacter::Tick(float DeltaSeconds)
|
||||
}
|
||||
}
|
||||
#pragma endregion Actor
|
||||
|
||||
|
@ -34,6 +34,11 @@ public:
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Ability System")
|
||||
TObjectPtr<UAttributeSet> Attributes;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Ability System")
|
||||
TSubclassOf<UGameplayEffect> DefaultAttributes;
|
||||
|
||||
void InitDefaultAttributes();
|
||||
#pragma endregion Ability System
|
||||
|
||||
#pragma region Combat
|
||||
|
Reference in New Issue
Block a user