コード例 #1
0
    public bool CheckWinCondition()
    {
        if (wallsPlayerOne.Count == 0 || wallsPlayerTwo.Count == 0) //if there is no more walls to break, finish the game. Note: no tie feature
        {
            int playerId = wallsPlayerOne.Count == 0 ? 2 : 1;       //Finde the winner

            if (gameMode == 0)                                      //COOP or SOLO mode just have the timer and dont have a winner
            {
                pl.SetTimer(gameTime);
            }
            else//VS mode shows just the winner, but not the timer
            {
                pl.SetVsWinner(playerId);
            }

            GameEvents.OnGameEnd.Invoke();
            return(true);
        }
        return(false);
    }