Ejemplo n.º 1
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());
    }