private void UpdateGameState() { currentGameStateNumber = model.gameState; currentGameState = (GameRefModel.GameState)currentGameStateNumber; if (OnNetworkGameStateUpdate != null) { OnNetworkGameStateUpdate(currentGameStateNumber, currentGameState); } }
private void GameStart(int gameStateNumber, GameRefModel.GameState gameState) { if (realtimeView.isOwnedLocallyInHierarchy && app.networkSyncManager.currentGameState == GameRefModel.GameState.GamePlaying) { if (myTeamColor == app.networkSyncManager.currentSyncedTurnColor) { myBoatPlan.SetActive(true); myBoatView.turnHighlighter.SetActive(true); } else { myBoatPlan.SetActive(false); myBoatView.turnHighlighter.SetActive(false); } } if (realtimeView.isOwnedLocallyInHierarchy && app.networkSyncManager.currentGameState == GameRefModel.GameState.GameOver) { myBoatPlan.SetActive(false); myBoatView.turnHighlighter.SetActive(false); } }
private void OnGameStateUpdate(int gameStateNumber, GameRefModel.GameState gameState) { if (gameState == GameRefModel.GameState.GameMatching) { app.uiView.gameStatusText.text = "WAITING FOR PLAYERS"; } if (gameState == GameRefModel.GameState.GamePlaying) { UpdateTurnText(); } if (gameState == GameRefModel.GameState.GameOver) { if (app.gameRefModel.localTeamModel.boatCount == 0) { app.uiView.gameStatusText.text = "YOU LOSE"; } else { app.uiView.gameStatusText.text = "YOU WIN!"; } app.uiView.playAgain.SetActive(true); } }
public void UpdateNetworkedGameState(GameRefModel.GameState newGameState) { model.gameState = (int)newGameState; }