private void OnMatchOutcomeDecided(bool p1wins) { Debug.LogFormat("Beetle {0} wins", p1wins ? m_player1.name : m_player2.name); if (p1wins) { m_player1.GainPoint(); } else { m_player2.GainPoint(); } // Fill all points for player 1 for (int i = 0; i < m_player1.Points; ++i) { m_visuals.P1Points[i].SetActive(true); } // Fill all points for player 2 for (int i = 0; i < m_player2.Points; ++i) { m_visuals.P2Points[i].SetActive(true); } // Handle the match/game winner string text = string.Format("Player {0}", p1wins ? "1" : "2"); bool matchEnded = false; if ( m_player1.Points >= GameConstants.POINTS_TO_WIN || m_player2.Points >= GameConstants.POINTS_TO_WIN) { matchEnded = true; text += " is the winner!"; } else { text += " won this round!"; } m_winnerText.text = text; m_winnerText.DOFade(1, 0.35f); m_winnerText.rectTransform.DOScale(Vector3.zero, 2).From().SetEase(Ease.OutBack).OnComplete(() => { FMODUnity.RuntimeManager.PlayOneShot("event:/Character/AttackWhistle"); m_winnerText.DOFade(0, 0.15f).SetDelay(1f).OnComplete(() => { if (matchEnded) { MusicController.MC.GameStartedMusic(); SceneManager.LoadScene("TitleScreen", LoadSceneMode.Single); } else { RestartRound(); } }); }); }