init ability actor info
This commit is contained in:
parent
ac3ec88290
commit
6b399f2c91
@ -3,9 +3,11 @@
|
|||||||
|
|
||||||
#include "Character/AuraCharacter.h"
|
#include "Character/AuraCharacter.h"
|
||||||
|
|
||||||
|
#include "AbilitySystemComponent.h"
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
#include "GameFramework/CharacterMovementComponent.h"
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
#include "GameFramework/SpringArmComponent.h"
|
#include "GameFramework/SpringArmComponent.h"
|
||||||
|
#include "Player/AuraPlayerState.h"
|
||||||
|
|
||||||
AAuraCharacter::AAuraCharacter()
|
AAuraCharacter::AAuraCharacter()
|
||||||
{
|
{
|
||||||
@ -35,3 +37,29 @@ AAuraCharacter::AAuraCharacter()
|
|||||||
bUseControllerRotationYaw = false;
|
bUseControllerRotationYaw = false;
|
||||||
bUseControllerRotationRoll = false;
|
bUseControllerRotationRoll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 server
|
||||||
|
InitAbilityActorInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AAuraCharacter::InitAbilityActorInfo()
|
||||||
|
{
|
||||||
|
AAuraPlayerState *AuraPlayerState = GetPlayerState<AAuraPlayerState>();
|
||||||
|
check(AuraPlayerState);
|
||||||
|
AuraPlayerState->GetAbilitySystemComponent()->InitAbilityActorInfo(AuraPlayerState, this);
|
||||||
|
|
||||||
|
AbilitySystemComponent = AuraPlayerState->GetAbilitySystemComponent();
|
||||||
|
AttributeSet = AuraPlayerState->GetAttributeSet();
|
||||||
|
}
|
||||||
|
@ -31,3 +31,10 @@ void AAuraEnemy::UnHighlightActor()
|
|||||||
GetMesh()->SetRenderCustomDepth(false);
|
GetMesh()->SetRenderCustomDepth(false);
|
||||||
Weapon->SetRenderCustomDepth(false);
|
Weapon->SetRenderCustomDepth(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AAuraEnemy::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
AbilitySystemComponent->InitAbilityActorInfo(this, this);
|
||||||
|
}
|
||||||
|
@ -16,6 +16,8 @@ class AURA_API AAuraCharacter : public AAuraCharacterBase
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AAuraCharacter ();
|
AAuraCharacter ();
|
||||||
|
virtual void PossessedBy(AController* NewController) override;
|
||||||
|
virtual void OnRep_PlayerState() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY (EditAnywhere)
|
UPROPERTY (EditAnywhere)
|
||||||
@ -23,4 +25,6 @@ private:
|
|||||||
|
|
||||||
UPROPERTY (EditAnywhere)
|
UPROPERTY (EditAnywhere)
|
||||||
TObjectPtr<UCameraComponent> Camera;
|
TObjectPtr<UCameraComponent> Camera;
|
||||||
|
|
||||||
|
void InitAbilityActorInfo ();
|
||||||
};
|
};
|
||||||
|
@ -19,4 +19,7 @@ public:
|
|||||||
AAuraEnemy ();
|
AAuraEnemy ();
|
||||||
virtual void HighlightActor() override;
|
virtual void HighlightActor() override;
|
||||||
virtual void UnHighlightActor() override;
|
virtual void UnHighlightActor() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user