public void EndVote() { voteStarted = false; // UI for ending vote setVoteUI.SetActive(false); currentVoteUI.SetActive(false); voteTopRightUI.SetActive(false); playersUI.ClearSuspectedPlayer(suspectedPlayer); // End timer Timer.voteTimer.End(); // Update players UI foreach (PlayableCharacter character in FindObjectsOfType <PlayableCharacter>()) { playersUI.ClearVote(character); } // Handle voting off player if (playersVotingFor.Count > playersVotingAgainst.Count) { if (suspectedPlayer.IsMe()) { // Voted off player should be killer suspectedPlayer.Kill(); // Check if the game should now end as a result of the vote // Same number of traitors left as loyals - Traitors win if (NetworkManager.instance.NumberOfTeamRemaining(Team.Loyal) == NetworkManager.instance.NumberOfTeamRemaining(Team.Traitor)) { gameSceneManager.EndGame(Team.Traitor); } // No traitors left - Loyals win else if (NetworkManager.instance.NoTraitorsRemaining()) { gameSceneManager.EndGame(Team.Loyal); } // No loayls left - Traitors win else if (NetworkManager.instance.NoLoyalsRemaining()) { gameSceneManager.EndGame(Team.Traitor); } } // Show UI to say someone was voted off ShowVotingOutCome(suspectedPlayer.Owner.NickName); StartCoroutine(ShowOutcomeInProgress()); } else { // Show UI to say vote was unsuccessful ShowVotingUnsuccess(suspectedPlayer.Owner.NickName); StartCoroutine(ShowUnsuccessInProgress()); } // Stop music votingMusic.Stop(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.F1)) { m_GM.AddEnergy(1); } if (Input.GetKeyDown(KeyCode.F2)) { m_GM.EndGame(GnG.TeamType.Ghost); } if (Input.GetKeyDown(KeyCode.F3)) { m_GM.EndGame(GnG.TeamType.Reaper); } }
/// Return if all master tasks have been completed. If this is true the game /// should be ended and the loyals will win. public void CheckAllTasksCompleted() { if (NumberOfTasksCompleted() == tasks.Count && NetworkManager.instance.RoomPropertyIs <bool>("TasksSet", true) && !allTasksCompleted) { allTasksCompleted = true; gameSceneManager.EndGame(Team.Loyal); } }
// Update is called once per frame void Update() { // If a sabotage is currently active check if the game has ended and update the UI if (sabotageable != null) { sabotageTimeRemaining.text = $"{(int)Timer.sabotageTimer.TimeRemaining()}s"; // If the sabotage has not been completed in the time if (Timer.sabotageTimer.IsComplete()) { // End the game Timer.sabotageTimer.End(); gameSceneManager.EndGame(Team.Traitor); sabotageMusic.Stop(); // backgroundMusic.UnPause(); } // Set ui to show number of players currently fixing the sabotageable playersFixing.text = "Players Fixing: " + sabotageable.numberOfPlayersFixing; } }