Esempio n. 1
0
    public void NftComponent()
    {
        CatalogItem catalogItem = DataStore.i.builderInWorld.catalogItemDict.GetValues()[0];



        DCLBuilderInWorldEntity biwEntity = Utils.GetOrCreateComponent <DCLBuilderInWorldEntity>(scene.entities[ENTITY_ID].gameObject);

        biwEntity.Init(scene.entities[ENTITY_ID], null);

        NFTShape nftShape = (NFTShape)scene.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;

        scene.SharedComponentAttach(biwEntity.rootEntity.entityId, nftShape.id);

        Assert.IsTrue(biwEntity.IsEntityNFT());

        CatalogItem associatedCatalogItem = biwEntity.GetCatalogItemAssociated();

        Assert.IsTrue(associatedCatalogItem.IsNFT());
        Assert.AreEqual(associatedCatalogItem, catalogItem);
    }