GAS_Aura-Constructing the ASC and AS
1 在AuraCharacterBase.h中
protected:
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
TObjectPtr<UAttributeSet> AttributeSet;
2 在AuraEnemy.cpp中
构造中
{
AbilitySystemComponent = CreateDefaultSubobject<UAbilitySystemComponent>("AbilitySystemComponent");
AbilitySystemComponent->SetIsReplicated(true);
AttributeSet = CreateDefaultSubobject<AuraAttributeSet>("AttributeSet");
}
3 在AuraPlayerState.h中
protected:
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
TObjectPtr<UAttributeSet> AttributeSet;
4 在AuraPlayerState.cpp中
构造函数
{
AbilitySystemComponent = CreateDefaultSubobject<UAbilitySystemComponent>("AbilitySystemComponent");
AbilitySystemComponent->SetIsReplicated(true);
AttributeSet = CreateDefaultSubobject<AuraAttributeSet>("AttributeSet");
}
5 在AuraCharacterBase.h中
AuraCharacterBase类的继承增加public IAbilitySystemInterface
重写GetAbilitySystemComponent() const;
UAttributeSet* GetAttributeSet() const {return AttributeSet;}
6 在AuraPlayerState.h中
AuraPlayerState类的继承增加public IAbilitySystemInterface
重写GetAbilitySystemComponent() const;
UAttributeSet* GetAttributeSet() const {return AttributeSet;}