예제 #1
0
    // Use this for initialization
    async void Start()
    {
        var res = await _hologramCatalog.GetHologramsAsync();

        var collection = gameObject.GetComponent <ObjectCollection>();

        foreach (var r in res)
        {
            var obj = new ObjectCollection.CollectionNode()
            {
                Name = r.Name,
            };

            var cube = Instantiate(ListItemPrefab);

            // Set up properties on the instantiated prefab..
            var text = cube.GetComponentInChildren <TextMesh>();
            text.text = r.Name;

            cube.transform.parent = collection.transform;
            obj.transform         = cube.transform;

            collection.NodeList.Add(obj);
            _log.Log(r.Name);
        }
        _log.Log("DONE");
        collection.UpdateCollection();
    }
예제 #2
0
    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();
    }