void Update() { //var JoystickNames = Input.GetJoystickNames(); //Debug.Log(JoystickNames[1]); if (CurrentGameMode == GameType.GameMode.PVP) { #region Timer if (Paused == false) { TimeUpdateEvent.Invoke(); // Update Time passed } RoundTimerText.text = Clock.TimerObject.MainTime.ToString(); // Round Timer displayed as text // PreRoundTimer is not displayed if player control is enabled if (WaitForTimer == false && Clock.TimerObject.Wait == false) { PreRoundTimerText.text = ""; } else { PreRoundTimerText.text = Clock.TimerObject.SecondaryTime.ToString(); } #endregion // For if either character isDead if (PlayerCharacter.character.isDead == true || OpponentCharacter.character.isDead == true || Clock.TimerObject.MainTime < 0) { RoundBehaviour rb = gameObject.AddComponent <RoundBehaviour>(); // Round Behaviour added as a component if (PlayerCharacter.character.Health > OpponentCharacter.character.Health || OpponentCharacter.character.Health > PlayerCharacter.character.Health) { rb.GiveRound(PlayerCharacter, OpponentCharacter, Rounds, RoundMax); // Decide a winner between the two characters MainTimeEvent.Invoke(); } else if (PlayerCharacter.character.Health == OpponentCharacter.character.Health) // if Both PlayerCharacter and OpponnetCharacter havethe same health { rb.Tie(PlayerCharacter, OpponentCharacter, Rounds, RoundMax); // Give a draw Debug.Log("Player Health " + PlayerCharacter.character.Health + " Opponent Health " + OpponentCharacter.character.Health); MainTimeEvent.Invoke(); } ResetCharacters(PlayerCharacter); // Reset Player 1 ResetCharacters(OpponentCharacter); // Reset Player 2 Destroy(rb); // Destroys Commponent for Round Behaviour object } if (Rounds.Count >= 3) { MenuReturn = true; // Enabled if a return to the main menu is needed PreRoundTimerObject.SetActive(false); // Timer is no longer shown } else if (Rounds.Count < RoundMax && Clock.TimerObject.SecondaryTime < 0) { SecondaryTimeEvent.Invoke(); } // Switch to menu after set amount of time if (MenuReturn == true && Clock.TimerObject.SecondaryTime <= 3) { WinnerText.text = DisplayWinner(PlayerCharacter.character, OpponentCharacter.character) + " has Won!"; if (WinnerText.text == "") { WinnerText.text = "It's a Draw!"; } Results.SetActive(true); if (Input.GetKeyDown(KeyCode.Space)) { GGM.GoToScene(SceneToLoad); // Not the main Menu due to lack of Main Menu * } } // Setting FreezeControl to the same of Wait if (Clock.TimerObject.Wait == true) { WaitForTimer = true; } else { WaitForTimer = false; } } }