Skip to content

Commit bfb5c4e

Browse files
committed
[Bug] Fixed win status does not trigger when player killed all other players
1 parent 3f7c30e commit bfb5c4e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: Source/Bomber/Private/GameFramework/MyPlayerState.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ void AMyPlayerState::OnRep_EndGameState()
110110
// Applies currently changed End-Game state for this player
111111
void AMyPlayerState::ApplyEndGameState()
112112
{
113-
AMyPlayerController* MyPC = IsPlayerStateLocallyControlled() ? Cast<AMyPlayerController>(GetPlayerController()) : nullptr;
114-
if (MyPC)
113+
if (HasAuthority()
114+
&& UMyBlueprintFunctionLibrary::GetAlivePlayersNum() <= 1)
115115
{
116-
MyPC->SetEndGameState();
116+
AMyGameStateBase::Get().SetGameState(ECGS::EndGame);
117117
}
118118

119119
if (OnEndGameStateChanged.IsBound())

0 commit comments

Comments
 (0)