public void GameOver() { print("game over"); isGameOver = true; GameController.maincamera.enabled = true; OnTargetLoss(); scoreUi.SetActive(false); joystick.SetActive(false); menuGameUiContainer.SetActive(false); resultGameContainer = NetworkClient.resultGameContainer; resultHumanPlayerTxt = resultGameContainer.transform.Find("ResultPlayer1-Text").GetComponent <Text>(); resultAIPlayerTxt = resultGameContainer.transform.Find("ResultPlayer2-Text").GetComponent <Text>(); resultTxt = resultGameContainer.transform.Find("Result-Text").GetComponent <Text>(); if (player_score > AI_score) { resultTxt.text = NetworkClient.users[NetworkClient.clientID].name + " is the winner!!!!"; } else if (AI_score > player_score) { resultTxt.text = "AI computer is the winner!!!!"; } else//ticko { resultTxt.text = "Ticko"; } resultHumanPlayerTxt.text = NetworkClient.users[NetworkClient.clientID].name + "'s score : " + player_score.ToString(); resultAIPlayerTxt.text = "computer's score : " + AI_score.ToString(); LobbyState.currentState = LobbyState.GAME_OVER; }
public void UpdateScore(int score, int player) { if (player == PLAYER) { player_score = player_score + score; player_score_txt.text = player_score.ToString(); } else if (player == AI_PLAYER) { AI_score = AI_score + score; AI_score_txt.text = AI_score.ToString(); } }