Пример #1
0
    // Handles a player joining a room
    public void OnPlayerEnteredLobby(PUNNetworkPlayer player)
    {
        this.players.Add(player);

        // Refresh all UI elements
        UpdateLobbyUI();
    }
Пример #2
0
 // Handles a player joining a room
 public void OnPlayerEnteredLobby(PUNNetworkPlayer player)
 {
     this.players.Add(player);
     if (hostInLobby && !clientInLobby)
     {
         OnLobbyFull();
     }
     UpdateLobbyUI();
 }
Пример #3
0
    // Handle a network player signalling ready
    public void OnNetworkReady()
    {
        Audio.PlayMenuSound();

        // Hide "best of" selector arrows for local player
        LeftArrow.gameObject.SetActive(false);
        RightArrow.gameObject.SetActive(false);

        PUNNetworkPlayer.GetLocalPlayer().SetAsReady();
        OnPlayerSignalReady();
    }
Пример #4
0
    // Called when a player joins a room as host OR client
    public override void OnJoinedRoom()
    {
        Globals.Menu.UpdateConnectionStatus(NetGameStatus.ENTERING);

        // Instantiate the player input prefab and enable it
        GameObject playerObject = PhotonNetwork.Instantiate("PunPlayer", Vector3.zero, Quaternion.identity, 0);

        thisPlayer         = playerObject.GetComponent <PUNNetworkPlayer>();
        thisPlayer.enabled = true;

        // Set the player as host or client
        if (this.playerIsHost)
        {
            thisPlayer.SetAsHost();
        }

        // Signal to the lobby that a player has entered
        StartCoroutine(WaitAndShowLobby());
    }