OLS/Source/ols/Private/Player/OLSPlayerState.cpp

41 lines
1.4 KiB
C++

// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
#include "Player/OLSPlayerState.h"
#include "AbilitySystem/OLSAbilitySystemComponent.h"
#include "Player/OLSPlayerController.h"
AOLSPlayerState::AOLSPlayerState(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
{
// Create attribute sets here.
}
void AOLSPlayerState::PostInitializeComponents()
{
Super::PostInitializeComponents();
check(AbilitySystemComponent);
AbilitySystemComponent->InitAbilityActorInfo(this, GetPawn());
const TObjectPtr<UWorld> world = GetWorld();
if (world && world->IsGameWorld() && world->GetNetMode() != NM_Client)
{
const TObjectPtr<AGameStateBase> gameState = GetWorld()->GetGameState();
check(gameState);
// ULyraExperienceManagerComponent* ExperienceComponent = GameState->FindComponentByClass<ULyraExperienceManagerComponent>();
// check(ExperienceComponent);
// ExperienceComponent->CallOrRegister_OnExperienceLoaded(FOnLyraExperienceLoaded::FDelegate::CreateUObject(this, &ThisClass::OnExperienceLoaded));
}
}
AOLSPlayerController* AOLSPlayerState::GetOLSPlayerController() const
{
return Cast<AOLSPlayerController>(GetOwner());
}
UOLSAbilitySystemComponent* AOLSPlayerState::GetOLSAbilitySystemComponent() const
{
return AbilitySystemComponent;
}