Exemple #1
0
    private void OnEnable()
    {
        // Get all players

        PlayerSetupNetwork[] players = GameManager.GetAllPlayers();

        //Loop through and set up a list item for each player score

        foreach (PlayerSetupNetwork player in players)
        {
            // Debug.Log(player.username + "|" + player.GetComponent<CanvasManager>().kills + "|" + player.GetComponent<CanvasManager>().deaths);

            GameObject itemGO = Instantiate(playerScoreItem, playerList);
            if (blue)
            {
                itemGO.GetComponent <Image>().color = new Color(0, 0, 0);
                blue = false;
            }
            else
            {
                blue = true;
            }


            ScoreBoardItem item = itemGO.GetComponent <ScoreBoardItem>();

            if (item != null)
            {
                item.Setup(player.username, player.kills, player.deaths);
            }
        }
    }
Exemple #2
0
    public void AddPoint(int teamAPoint, int teamAPrevPoint, int teamBPoint, int teamBPrevPoint)
    {
        ScoreBoardItem scoreItem = Instantiate(scoreBoardPrefab);

        scoreItem.SetPoint(teamAPoint, teamAPrevPoint, teamBPoint, teamBPrevPoint);
        m_scoreBoardItemList.Add(scoreItem);
        scoreItem.transform.SetParent(Content);
    }