73. Player Level and Combat Interface

This commit is contained in:
2024-10-22 17:32:37 -04:00
parent d34201e8a1
commit 7e27f708cf
9 changed files with 75 additions and 3 deletions

View File

@ -1,5 +1,7 @@
#include "GasaPlayerState.h"
#include "Net/UnrealNetwork.h"
#include "Networking/GasaNetLibrary_Inlines.h"
#include "GasaGameInstance.h"
#include "GasaPlayerController.h"
@ -10,6 +12,8 @@ AGasaPlayerState::AGasaPlayerState()
{
bAutoAbilitySystem = true;
Level = 1;
AbilitySystem = CreateDefaultSubobject<UGasaAbilitySystemComp>("Ability System");
AbilitySystem->SetIsReplicated(true);
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
@ -20,6 +24,11 @@ AGasaPlayerState::AGasaPlayerState()
NetUpdateFrequency = 100.f;
}
void AGasaPlayerState::Client_OnRep_Level(int32 OldPlayerLevel)
{
}
#pragma region GameFramework
void AGasaPlayerState::OnGameFrameworkInitialized()
{
@ -87,6 +96,6 @@ void AGasaPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& Out
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AGasaPlayerState, Level);
}
#pragma endregion UObject

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "AbilitySystemInterface.h"
@ -17,6 +17,12 @@ class GASA_API AGasaPlayerState : public APlayerState
public:
AGasaPlayerState();
UPROPERTY(EditAnywhere, ReplicatedUsing="Client_OnRep_Level", Category="Gameplay")
int32 PlayerLevel;
UFUNCTION()
void Client_OnRep_Level(int32 OldLevel);
#pragma region Ability System
UPROPERTY(EditAnywhere, Category="Ability System")
bool bAutoAbilitySystem;