예제 #1
0
    //End of turn
    private void ChengeTurn()
    {
        //If player having turn didn't score - change player
        if (scoredBallsPerTurn.Count == 0 || scoredBallsPerTurn[scoredBallsPerTurn.Count - 1].FindAll(x => x.Equals(TurnBallType)).Count == 0)
        {
            playerTurn = (playerTurn + 1) % 2;
            //Update UI
            gameCommunicatesText.text = "Turn of player " + (playerTurn + 1);
            playerOneSign.text        = playerTurn == 0 ? "X" : "";
            playerTwoSign.text        = playerTurn == 1 ? "X" : "";
        }
        else
        {
            gameCommunicatesText.text = "Player " + (playerTurn + 1) + " continue turn";
        }

        stick.ShowStick();
        changeTeamInvoked = false;

        // Add new turn ball container
        scoredBallsPerTurn.Add(new List <Ball.BallType>());
        turn++;
    }