Пример #1
0
    public override void OnServerAddPlayer(NetworkConnection conn)
    {
        base.OnServerAddPlayer(conn);

        RTSPlayer player = conn.identity.GetComponent <RTSPlayer>();

        players.Add(player);

        player.SetDisplayName($"Player {players.Count}");

        player.SetTeamColour(UnityEngine.Random.ColorHSV(0f, 1f, 0.8f, 1f, 0.8f, 1f));

        player.SetPartyOwner(players.Count == 1);
    }
    public override void OnServerAddPlayer(NetworkConnection conn)
    {
        base.OnServerAddPlayer(conn);

        RTSPlayer player = conn.identity.GetComponent <RTSPlayer>();

        Players.Add(player);

        player.SetDisplayName($"Player {Players.Count}");

        player.SetTeamColour(new Color(
                                 UnityEngine.Random.Range(0f, 1f),
                                 UnityEngine.Random.Range(0f, 1f),
                                 UnityEngine.Random.Range(0f, 1f)
                                 ));

        player.SetPartyOwner(Players.Count == 1); // only set to party owner, if there is only one player
    }