22. Init ability actor info
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
#include "GasaPlayerController.h"
|
||||
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "Engine/LocalPlayer.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "GasaPlayerState.h"
|
||||
#include "Actors/CameraMount.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "Characters/GasaCharacter.h"
|
||||
@ -67,6 +69,15 @@ void AGasaPlayerController::OnPossess(APawn* InPawn)
|
||||
Super::OnPossess(InPawn);
|
||||
|
||||
Cam->AttachToActor(InPawn, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
|
||||
AGasaPlayerState* PS = GetPlayerState();
|
||||
AGasaCharacter* character = Cast<AGasaCharacter>(InPawn);
|
||||
// Net Owner setup ability system
|
||||
{
|
||||
character->AbilitySystem = PS->AbilitySystem;
|
||||
character->Attributes = PS->Attributes;
|
||||
character->AbilitySystem->InitAbilityActorInfo(PS, character);
|
||||
}
|
||||
}
|
||||
|
||||
void AGasaPlayerController::OnUnPossess()
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "GasaPlayerState.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
|
||||
#include "GasaPlayerController.generated.h"
|
||||
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class GASA_API AGasaPlayerController : public APlayerController
|
||||
{
|
||||
@ -48,11 +48,16 @@ public:
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Input")
|
||||
TObjectPtr<UInputAction> IA_Move;
|
||||
|
||||
void Move(FInputActionValue const& ActionValue);
|
||||
#pragma endregion Input
|
||||
|
||||
AGasaPlayerController();
|
||||
|
||||
void Move(FInputActionValue const& ActionValue);
|
||||
AGasaPlayerState* GetPlayerState()
|
||||
{
|
||||
return Cast<AGasaPlayerState>( PlayerState );
|
||||
}
|
||||
|
||||
#pragma region PlayerController
|
||||
void OnPossess(APawn* InPawn) override;
|
||||
|
@ -6,6 +6,7 @@ AGasaPlayerState::AGasaPlayerState()
|
||||
{
|
||||
AbilitySystem = CreateDefaultSubobject<UGasaAbilitySystemComp>("Ability System");
|
||||
AbilitySystem->SetIsReplicated(true);
|
||||
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
|
||||
|
||||
Attributes = CreateDefaultSubobject<UAttributeSet>("Attributes");
|
||||
|
||||
|
@ -31,4 +31,8 @@ public:
|
||||
FORCEINLINE UAttributeSet* GetAttributes() { return Attributes; }
|
||||
FORCEINLINE UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; }
|
||||
#pragma endregion IAbilitySystem
|
||||
|
||||
#pragma region
|
||||
|
||||
#pragma endregion
|
||||
};
|
||||
|
Reference in New Issue
Block a user