Post match menu and logic
This commit is contained in:
		
							parent
							
								
									b02344f256
								
							
						
					
					
						commit
						672044445c
					
				
							
								
								
									
										
											BIN
										
									
								
								GravityStomp/Content/Characters/BP_GSCharacter.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								GravityStomp/Content/Characters/BP_GSCharacter.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								GravityStomp/Content/Core/BP_GSDefaultGameMode.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								GravityStomp/Content/Core/BP_GSDefaultGameMode.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								GravityStomp/Content/Core/BP_GSPlayerController.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								GravityStomp/Content/Core/BP_GSPlayerController.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								GravityStomp/Content/Maps/Debug/Test.umap
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								GravityStomp/Content/Maps/Debug/Test.umap
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								GravityStomp/Content/UI/InGame/WBP_PauseMenu.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								GravityStomp/Content/UI/InGame/WBP_PauseMenu.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								GravityStomp/Content/UI/InGame/WBP_PostMatchMenu.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								GravityStomp/Content/UI/InGame/WBP_PostMatchMenu.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -97,7 +97,7 @@ void AGSCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputC | |||||||
| 
 | 
 | ||||||
| void AGSCharacter::Move(const FInputActionValue& Value) | void AGSCharacter::Move(const FInputActionValue& Value) | ||||||
| { | { | ||||||
|     if(UGameplayStatics::GetGlobalTimeDilation(this) < 1.0f) |     if(UGameplayStatics::GetGlobalTimeDilation(this) < 1.0f || IsMoveInputIgnored()) | ||||||
|     { |     { | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| @ -113,7 +113,7 @@ void AGSCharacter::Move(const FInputActionValue& Value) | |||||||
| 
 | 
 | ||||||
| void AGSCharacter::ChangeGravityDirection(const FInputActionValue& Value) | void AGSCharacter::ChangeGravityDirection(const FInputActionValue& Value) | ||||||
| { | { | ||||||
|     if(!bCanChangeGravity || UGameplayStatics::GetGlobalTimeDilation(this) < 1.0f) |     if(!bCanChangeGravity || UGameplayStatics::GetGlobalTimeDilation(this) < 1.0f || IsMoveInputIgnored()) | ||||||
|     { |     { | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -166,11 +166,7 @@ void AGSGameModeBase::DefaultTimer() | |||||||
|         GS->SetRemainingTime(GS->GetRemainingTime() - 1); |         GS->SetRemainingTime(GS->GetRemainingTime() - 1); | ||||||
|         if(GS->GetRemainingTime() <= 0) |         if(GS->GetRemainingTime() <= 0) | ||||||
|         { |         { | ||||||
|             if(GetMatchState() == MatchState::WaitingPostMatch) |             if (GetMatchState() == MatchState::InProgress) | ||||||
|             { |  | ||||||
|                 RestartGame(); |  | ||||||
|             } |  | ||||||
|             else if (GetMatchState() == MatchState::InProgress) |  | ||||||
|             { |             { | ||||||
|                 FinishMatch(); |                 FinishMatch(); | ||||||
|             } |             } | ||||||
| @ -208,9 +204,18 @@ void AGSGameModeBase::FinishMatch() | |||||||
|             Pawn->TurnOff(); |             Pawn->TurnOff(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // set game state remaining time to time between matches
 |         GetWorldTimerManager().ClearTimer(TimerHandle_DefaultTimer); | ||||||
|         GS->SetRemainingTime(TimeBetweenRounds); |  | ||||||
|         GS->ResetTeamScores(); |         GS->ResetTeamScores(); | ||||||
|  | 
 | ||||||
|  |         OnMatchFinished(); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void AGSGameModeBase::OnMatchRestartRequest() | ||||||
|  | { | ||||||
|  |     if(GetMatchState() == MatchState::WaitingPostMatch) | ||||||
|  |     { | ||||||
|  |         RestartGame(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -286,8 +291,12 @@ void AGSGameModeBase::HandleMatchHasStarted() | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| void AGSGameModeBase::RestartGame() | void AGSGameModeBase::RestartGame() | ||||||
| { | { | ||||||
|  |     // Setup timer for match tick
 | ||||||
|  |     GetWorldTimerManager().SetTimer(TimerHandle_DefaultTimer, this, &AGSGameModeBase::DefaultTimer, GetWorldSettings()->GetEffectiveTimeDilation(), true); | ||||||
|  | 
 | ||||||
|     // notify players game has restarted
 |     // notify players game has restarted
 | ||||||
|     for(FConstPlayerControllerIterator It = GetWorld()->GetPlayerControllerIterator(); It; ++It) |     for(FConstPlayerControllerIterator It = GetWorld()->GetPlayerControllerIterator(); It; ++It) | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -80,6 +80,15 @@ public: | |||||||
| 	 */ | 	 */ | ||||||
| 	void FinishMatch(); | 	void FinishMatch(); | ||||||
| 
 | 
 | ||||||
|  | 	UFUNCTION(BlueprintImplementableEvent) | ||||||
|  | 	void OnMatchFinished(); | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 *	If the match is in the post match state calling this restarts the game  | ||||||
|  | 	 */ | ||||||
|  | 	UFUNCTION(BlueprintCallable) | ||||||
|  | 	virtual void OnMatchRestartRequest(); | ||||||
|  | 
 | ||||||
| 	virtual void HandleStartingNewPlayer_Implementation(APlayerController* NewPlayer) override; | 	virtual void HandleStartingNewPlayer_Implementation(APlayerController* NewPlayer) override; | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
|  | |||||||
| @ -41,10 +41,14 @@ void AGSPlayerController::Client_GameRestarted_Implementation() | |||||||
|     OnGameRestarted(); |     OnGameRestarted(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void AGSPlayerController::GameHasEnded(AActor* EndGameFocus, bool bIsWinner) | ||||||
|  | { | ||||||
|  |     // don't set a view target
 | ||||||
|  |     ClientGameEnded(EndGameFocus, bIsWinner); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void AGSPlayerController::ClientGameEnded_Implementation(AActor* EndGameFocus, bool bIsWinner) | void AGSPlayerController::ClientGameEnded_Implementation(AActor* EndGameFocus, bool bIsWinner) | ||||||
| { | { | ||||||
|     Super::ClientGameEnded_Implementation(EndGameFocus, bIsWinner); |  | ||||||
| 
 |  | ||||||
|     SetIgnoreMoveInput(true); |     SetIgnoreMoveInput(true); | ||||||
| 
 | 
 | ||||||
|     APawn* MyPawn = GetPawn(); |     APawn* MyPawn = GetPawn(); | ||||||
|  | |||||||
| @ -81,6 +81,11 @@ public: | |||||||
| 	void OnGameRestarted(); | 	void OnGameRestarted(); | ||||||
| 
 | 
 | ||||||
| 	// APlayerController interface
 | 	// APlayerController interface
 | ||||||
|  | 	/**
 | ||||||
|  | 	 *	Override so no view target is set | ||||||
|  | 	 */ | ||||||
|  | 	virtual void GameHasEnded(AActor* EndGameFocus, bool bIsWinner) override; | ||||||
|  | 
 | ||||||
|     /**
 |     /**
 | ||||||
|      *	Does character cleanup when the game ends |      *	Does character cleanup when the game ends | ||||||
|      */ |      */ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user