Beispiel #1
0
    // ----------------- Server callbacks ------------------

    //we want to disable the button JOIN if we don't have enough player
    //But OnLobbyClientConnect isn't called on hosting player. So we override the lobbyPlayer creation
    public override GameObject OnLobbyServerCreateLobbyPlayer(NetworkConnection conn, short playerControllerId)
    {
        GameObject obj = Instantiate(lobbyPlayerPrefab.gameObject) as GameObject;

        HoloLensLobbyPlayer newPlayer = obj.GetComponent <HoloLensLobbyPlayer>();

        PlayerList.instance.AddPlayer(newPlayer);

        return(obj);
    }
    public void AddPlayer(HoloLensLobbyPlayer player)
    {
        // Need to clone the lobby player prefab here at this point..
        var cn = new ObjectCollection.CollectionNode();

        // try not reparenting here as it causes a problem where when you switch scenes to the
        // game scene these get destroyed and recreated in an unexpected location in the hierarchy
        //
        cn.transform = player.transform;
        //player.transform.parent = this.transform;
        NodeList.Add(cn);
        UpdateCollection();
    }
Beispiel #3
0
 public void RemovePlayer(HoloLensLobbyPlayer player)
 {
     player.RemovePlayer();
 }