-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented FPSPlayerConroller for multiplayer mode
- Loading branch information
Showing
8 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#include "FPSGameState.h" | ||
#include "FPSPlayerController.h" | ||
#include "Engine/World.h" | ||
|
||
|
||
void AFPSGameState::MulticastOnMissionComplete_Implementation(APawn* InstigatorPawn, bool bMissionSuccess) | ||
{ | ||
for(FConstPawnIterator it = GetWorld()->GetPawnIterator(); it; it++) | ||
for (FConstPlayerControllerIterator It = GetWorld()->GetPlayerControllerIterator(); It; It++) | ||
{ | ||
APawn* Pawn = it->Get(); | ||
if (Pawn && Pawn->IsLocallyControlled()) | ||
AFPSPlayerController* PlayerController = Cast<AFPSPlayerController>(It->Get()); | ||
if (PlayerController && PlayerController->IsLocalController()) | ||
{ | ||
Pawn->DisableInput(nullptr); | ||
PlayerController->OnMissionCompleted(InstigatorPawn, bMissionSuccess); | ||
|
||
// Disable input | ||
APawn* Pawn = PlayerController->GetPawn(); | ||
if (Pawn && Pawn->IsLocallyControlled()) | ||
{ | ||
Pawn->DisableInput(nullptr); | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#include "FPSPlayerController.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "GameFramework/PlayerController.h" | ||
#include "FPSPlayerController.generated.h" | ||
|
||
/** | ||
* | ||
*/ | ||
UCLASS() | ||
class FPSGAME_API AFPSPlayerController : public APlayerController | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UFUNCTION(BlueprintImplementableEvent, Category = "PlayerController") | ||
void OnMissionCompleted(APawn* InstigatorPawn, bool bMissionSuccess); | ||
}; |