1 在AuraEnemy.h中

增加注释,/** Enemy Interface */ ,/** end Enemy Interface */

protected:

  virtual void beginplay();

2 在 AuraEnemy.cpp中

beginplay()

{

  check(AbilitySystemComponent)

  AbilitySystemComponent->InitAbilityActorInfo(this,this); 

}

3 在AuraCharacter.h中

virtual void PossedBy() override;

virtual void OnRep_PlayerState() override;

private:

  void InitAbilityActorInfo();

4 在AuraCharacter.cpp中

PossedBy()

{

  InitAbilityActorInfo();

}

OnRep_PlayerState()

{

  InitAbilityActorInfo();

}

InitAbilityActorInfo()

{

  

//Init ability Actor Info for the Server

  AAuraPlayerState* AuraPlayerState = GetPlayerState<AAuraPlayerState>();

  check(AuraPlayerState);

  AuraPlayerState->GetAbilitySystemComponent()->InitAbilityActorInfo(AuraPlayerState,this);

  AttributeSet = AuraPlayerState->GetAttributeSet();

}

posted on 2025-08-13 18:36  偷懒的阿贤  阅读(12)  评论(0)    收藏  举报