Exemplo n.º 1
0
    public void OnReadyBeforeLoading()
    {
        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero, Utils.GetTestsAssetsPath() + "/GLB/Trevor/Trevor.glb", out DecentralandEntity entity);

        bool isOnReady = false;

        gltfShape.CallWhenReady((x) => { isOnReady = true; });

        Assert.IsFalse(isOnReady);
    }
Exemplo n.º 2
0
    public IEnumerator OnReadyAfterLoadingInstantlyCalled()
    {
        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero, Utils.GetTestsAssetsPath() + "/GLB/Trevor/Trevor.glb", out DecentralandEntity entity);

        yield return(TestHelpers.WaitForGLTFLoad(entity));

        bool isOnReady = false;

        gltfShape.CallWhenReady((x) => { isOnReady = true; });
        Assert.IsTrue(isOnReady);
    }
    public IEnumerator OnReadyWaitLoading()
    {
        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero, TestAssetsUtils.GetPath() + "/GLB/Trevor/Trevor.glb", out IDCLEntity entity);

        bool isOnReady = false;

        gltfShape.CallWhenReady((x) => { isOnReady = true; });
        yield return(TestHelpers.WaitForGLTFLoad(entity));

        Assert.IsTrue(isOnReady);
    }
Exemplo n.º 4
0
    public void OnReadyWithoutAttachInstantlyCalled()
    {
        GLTFShape gltfShape = TestHelpers.SharedComponentCreate <GLTFShape, GLTFShape.Model>(scene, CLASS_ID.GLTF_SHAPE, new LoadableShape.Model()
        {
            src = Utils.GetTestsAssetsPath() + "/GLB/Trevor/Trevor.glb"
        });

        bool isOnReady = false;

        gltfShape.CallWhenReady((x) => { isOnReady = true; });

        Assert.IsTrue(isOnReady);
    }
Exemplo n.º 5
0
    private void AddShape(CatalogItem catalogItem, BIWEntity entity)
    {
        if (catalogItem.IsNFT())
        {
            NFTShape nftShape = (NFTShape)sceneToEdit.SharedComponentCreate(catalogItem.id, Convert.ToInt32(CLASS_ID.NFT_SHAPE));
            nftShape.model         = new NFTShape.Model();
            nftShape.model.color   = new Color(0.6404918f, 0.611472f, 0.8584906f);
            nftShape.model.src     = catalogItem.model;
            nftShape.model.assetId = catalogItem.id;
            sceneToEdit.SharedComponentAttach(entity.rootEntity.entityId, nftShape.id);

            nftShape.CallWhenReady(entity.ShapeLoadFinish);
        }
        else
        {
            GLTFShape gltfComponent = (GLTFShape)sceneToEdit.SharedComponentCreate(catalogItem.id, Convert.ToInt32(CLASS_ID.GLTF_SHAPE));
            gltfComponent.model         = new LoadableShape.Model();
            gltfComponent.model.src     = catalogItem.model;
            gltfComponent.model.assetId = catalogItem.id;
            sceneToEdit.SharedComponentAttach(entity.rootEntity.entityId, gltfComponent.id);

            gltfComponent.CallWhenReady(entity.ShapeLoadFinish);
        }
    }