Exemplo n.º 1
0
    // Fill the list playerScores
    private void ComputeScores()
    {
        float defendersBasePoint = scoringData.GetDefendersBasePoint();

        scoringData.PrintSummary();
        Debug.Log("Defender base points of " + defendersBasePoint);
        int nPlayer    = players.Count;
        int nDefenders = GetNDefenders();

        playerScores = new List <float>();
        foreach (Player p in players.Items)
        {
            float score = 0;
            if (p.team == DEFENDER_TEAM_INDEX)
            {
                score = defendersBasePoint;
            }
            else                                     // taker team
            {
                if (nPlayer == 5 && nDefenders == 3) // in the case the main player has an ally
                {
                    score = (p == Taker) ? -2 * defendersBasePoint : -defendersBasePoint;
                }
                else
                {
                    score = -nDefenders * defendersBasePoint;
                }
            }
            playerScores.Add(score);
        }

        // Check the total points (should be 0)
        float total = 0;

        foreach (float s in playerScores)
        {
            total += s;
        }
        Debug.Log("Total score: " + total + " (should be 0)");
    }
Exemplo n.º 2
0
 void Start()
 {
     scoringData.PrintSummary();
 }