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;}

posted on 2025-08-12 19:22  偷懒的阿贤  阅读(7)  评论(0)    收藏  举报