void ATGProjectPlayerState::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
if (UTGSettings::Get().bSaveGame)
{
if (GetNetMode() == NM_DedicatedServer)
{
//创建游戏保存
UTGSaveGame* SaveGame = Cast<UTGSaveGame>(UGameplayStatics::CreateSaveGameObject(UTGSaveGame::StaticClass()));
if (SaveGame)
{
SaveGame->SG_CurHP = CurHP;
SaveGame->SG_MaxHP = MaxHP;
//保存文件
UGameplayStatics::SaveGameToSlot(SaveGame, FString("TGSaveGame_" + GetPlayerName()), 0);
}
}
}
Super::EndPlay(EndPlayReason);
}