Exemple #1
0
    private void OnEnable()
    {
        Player[] players = GameManger.GetAllPlayers();
        Array.Sort(players, ComparePlayers);

        foreach (Player player in players)
        {
            GameObject           itemGO = Instantiate(playerScoreboardItem, playerScoreboardList) as GameObject;
            PlayerScoreboardItem item   = itemGO.GetComponent <PlayerScoreboardItem>();
            if (item != null)
            {
                item.Setup(player.playerName, player.score, player.kills, player.deaths);
            }
            if (player.isLocalPlayer)
            {
                item.GetComponent <Image>().color = Color.cyan;
            }
        }
    }