void AMyGameStateBase::MulticastOnLevelComplete_Implementation(APawn*
character, bool succeeded){
if (succeeded){
for (FConstPawnIterator it = GetWorld()->GetPawnIterator();
it; it++){
APawn* pawn = it->Get();
if (pawn && pawn->IsLocallyControlled()) {
pawn->DisableInput(nullptr);
}
MyGameStateBase.cpp
}
for (FConstPlayerControllerIterator it = GetWorld()->
GetPlayerControllerIterator(); it; it++){
AMyPlayerController* pController =
Cast<AMyPlayerController>(it->Get());
if ((pController) && (pController->IsLocalController())) {
pController->OnLevelCompleted(character, succeeded);
}
}
}
else{
if (character){
character->DisableInput(nullptr);
AMyPlayerController* pController =
Cast<AMyPlayerController>(character->GetController());
if ((pController) && (pController->IsLocalController())) {
pController->OnLevelCompleted(character, succeeded);
} } }
}