Пример #1
0
    void SetupPlayers()
    {
        int key1 = (1 + offset) % PhotonNetwork.playerList.Length;

        Player player1 = LevelManager.instance.players[(0 + offset) % PhotonNetwork.playerList.Length];
        Player player2 = LevelManager.instance.players[(1 + offset) % PhotonNetwork.playerList.Length];

        if (PhotonNetwork.playerList.Length >= 3)
        {
            Player player3 = LevelManager.instance.players [(2 + offset) % PhotonNetwork.playerList.Length];

            if (PhotonNetwork.playerList.Length == 4)
            {
                Player player4 = LevelManager.instance.players [(3 + offset) % PhotonNetwork.playerList.Length];

                opponentHUDs [2].GetComponent <OpponentHUD> ().setPlayer(player4);
            }
            else
            {
                opponentHUDs [2].gameObject.SetActive(false);
            }
            opponentHUDs [1].GetComponent <OpponentHUD> ().setPlayer(player3);
        }
        else
        {
            opponentHUDs [1].gameObject.SetActive(false);
            opponentHUDs [2].gameObject.SetActive(false);
        }
        opponentHUDs [0].GetComponent <OpponentHUD> ().setPlayer(player2);
        playerHUD.GetComponent <PlayerHUD> ().setPlayer(player1);
    }