Init Ability Actor Info
This commit is contained in:
@ -3,9 +3,11 @@
|
||||
|
||||
#include "Character/AuraCharacter.h"
|
||||
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
#include "Player/AuraPlayerState.h"
|
||||
|
||||
AAuraCharacter::AAuraCharacter()
|
||||
{
|
||||
@ -28,3 +30,28 @@ AAuraCharacter::AAuraCharacter()
|
||||
Camera->SetupAttachment(CameraBoom);
|
||||
}
|
||||
|
||||
void AAuraCharacter::PossessedBy(AController* NewController)
|
||||
{
|
||||
Super::PossessedBy(NewController);
|
||||
|
||||
// Init ability actor info for the Server
|
||||
InitAbilityActorInfo();
|
||||
}
|
||||
|
||||
void AAuraCharacter::OnRep_PlayerState()
|
||||
{
|
||||
Super::OnRep_PlayerState();
|
||||
|
||||
// Init ability actor info for the Client
|
||||
InitAbilityActorInfo();
|
||||
}
|
||||
|
||||
void AAuraCharacter::InitAbilityActorInfo()
|
||||
{
|
||||
AAuraPlayerState* AuraPlayerState = GetPlayerState<AAuraPlayerState>();
|
||||
check(AuraPlayerState);
|
||||
AuraPlayerState->GetAbilitySystemComponent()->InitAbilityActorInfo(AuraPlayerState, this);
|
||||
AbilitySystemComponent = AuraPlayerState->GetAbilitySystemComponent();
|
||||
AttributeSet = AuraPlayerState->GetAttributeSet();
|
||||
}
|
||||
|
||||
|
@ -35,3 +35,9 @@ void AAuraEnemy::UnHighlightActor()
|
||||
GetMesh()->SetRenderCustomDepth(false);
|
||||
Weapon->SetRenderCustomDepth(false);
|
||||
}
|
||||
|
||||
void AAuraEnemy::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
AbilitySystemComponent->InitAbilityActorInfo(this, this);
|
||||
}
|
||||
|
@ -26,4 +26,9 @@ private:
|
||||
|
||||
public:
|
||||
AAuraCharacter();
|
||||
virtual void PossessedBy(AController* NewController) override;
|
||||
virtual void OnRep_PlayerState() override;
|
||||
|
||||
private:
|
||||
void InitAbilityActorInfo();
|
||||
};
|
||||
|
@ -17,6 +17,11 @@ class AURA_API AAuraEnemy : public AAuraCharacterBase, public IEnemyInterface
|
||||
|
||||
public:
|
||||
AAuraEnemy();
|
||||
/** Enemy Interface */
|
||||
virtual void HighlightActor() override;
|
||||
virtual void UnHighlightActor() override;
|
||||
/** End Enemy Interface */
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user