< Summary

Class:BIWEntity
Assembly:BuilderEntity
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BuilderEntity/BIWEntity.cs
Covered lines:136
Uncovered lines:164
Coverable lines:300
Total lines:686
Line coverage:45.3% (136 of 300)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BIWEntity()0%110100%
Initialize(...)0%44093.75%
GetCatalogItemAssociated()0%8.798076.92%
HasShape()0%2100%
HasMovedSinceLastReport()0%2100%
HasScaledSinceLastReport()0%2100%
HasRotatedSinceLastReport()0%2100%
PositionReported()0%2100%
ScaleReported()0%2100%
RotationReported()0%2100%
CheckErrors()0%550100%
SetEntityBoundariesError(...)0%110100%
Select()0%2100%
Deselect()0%12300%
ToggleShowStatus()0%6200%
ToggleLockStatus()0%2100%
ShapeLoadFinish(...)0%6200%
Delete()0%6200%
Dispose()0%42600%
DestroyColliders()0%12300%
AddRotation(...)0%110100%
SetRotation(...)0%2100%
GetEulerRotation()0%110100%
InitRotation()0%220100%
HasSmartItemComponent()0%220100%
HasSmartItemActions()0%2100%
GetSmartItemParameters()0%2100%
GetSmartItemActions()0%2100%
GetIsLockedValue()0%2.152066.67%
SetIsLockedValue(...)0%6200%
SetDescriptiveName(...)0%12300%
GetDescriptiveName()0%3.333066.67%
ResetTransfrom()0%6200%
ShapeInit()0%5.475073.33%
HandleAnimation()0%2.032080%
DefaultAnimationStop()0%12300%
DefaultAnimationSample(...)0%15.555025%
SetOriginalMaterials()0%72800%
SetEntityAsVoxel()0%2100%
SaveOriginalMaterial()0%15.3515088.46%
SetEditMaterial()0%1101000%
OnNameUpdate(...)0%6200%
OnShapeUpdate(...)0%2.062075%
CreateCollidersForEntity(...)0%26.1416065.91%
IsEntityNFT()0%110100%
IsEntityAFloor()0%330100%
IsEntityAVoxel()0%9.498071.43%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BuilderEntity/BIWEntity.cs

#LineLine coverage
 1using DCL;
 2using DCL.Components;
 3using DCL.Configuration;
 4using DCL.Controllers;
 5using DCL.Helpers;
 6using DCL.Models;
 7using System;
 8using System.Collections.Generic;
 9using DCL.Builder;
 10using UnityEngine;
 11
 12public class BIWEntity
 13{
 014    public GameObject gameObject => rootEntity.gameObject;
 015    public Transform transform => rootEntity.gameObject.transform;
 16
 36817    public IDCLEntity rootEntity { protected set; get; }
 18    public string entityUniqueId;
 19
 20    public event Action<BIWEntity> OnShapeFinishLoading;
 21    public event Action<BIWEntity> OnStatusUpdate;
 22    public event Action<BIWEntity> OnDelete;
 23    public event Action<BIWEntity> OnErrorStatusChange;
 24
 025    public bool isDeleted { get; private set; }
 26
 27    public bool isLocked
 28    {
 129        get { return GetIsLockedValue(); }
 30        set
 31        {
 032            SetIsLockedValue(value);
 033            OnStatusUpdate?.Invoke(this);
 034        }
 35    }
 36
 37    private bool isSelectedValue = false;
 38
 39    public bool isSelected
 40    {
 541        get { return isSelectedValue; }
 42        set
 43        {
 044            isSelectedValue = value;
 045            OnStatusUpdate?.Invoke(this);
 046        }
 47    }
 48
 49    private bool isNewValue = false;
 50
 51    public bool isNew
 52    {
 153        get { return isNewValue; }
 54        set
 55        {
 056            isNewValue = value;
 057            OnStatusUpdate?.Invoke(this);
 058        }
 59    }
 60
 4161    private bool isVisibleValue = true;
 62
 63    public bool isVisible
 64    {
 065        get { return isVisibleValue; }
 66        set
 67        {
 1468            isVisibleValue = value;
 69
 1470            if (rootEntity != null && rootEntity.gameObject != null)
 71            {
 1472                rootEntity.gameObject.SetActive(isVisibleValue);
 73            }
 74
 1475            OnStatusUpdate?.Invoke(this);
 076        }
 77    }
 78
 1979    public bool isLoaded { get; internal set; } = false;
 80
 1681    public bool isVoxel { get; set; } = false;
 82
 83    private CatalogItem associatedCatalogItem;
 84
 2185    public bool isFloor { get; set; } = false;
 2986    public bool isNFT { get; private set; } = false;
 87
 88    private bool isShapeComponentSet = false;
 89
 90    private Animation[] meshAnimations;
 91
 92    private Vector3 currentRotation;
 93    private Transform originalParent;
 94
 95    private Material[] originalMaterials;
 96
 97    private Material editMaterial;
 98
 4199    private Dictionary<string, List<GameObject>> collidersGameObjectDictionary = new Dictionary<string, List<GameObject>
 100
 101    private Vector3 lastPositionReported;
 102    private Vector3 lastScaleReported;
 103    private Quaternion lastRotationReported;
 104
 105    #region Error Handler definition
 106
 6107    public bool hasError  { get; private set; } = false;
 108
 4109    public bool hasMissingCatalogItemError { get; private set; } = false;
 8110    public bool isInsideBoundariesError { get; private set; } = false;
 111
 112    #endregion
 113
 114    public void Initialize(IDCLEntity entity, Material editMaterial)
 115    {
 15116        rootEntity = entity;
 15117        rootEntity.OnShapeUpdated += OnShapeUpdate;
 15118        rootEntity.OnNameChange += OnNameUpdate;
 119
 15120        this.editMaterial = editMaterial;
 15121        isVoxel = false;
 122
 123
 15124        entityUniqueId = (rootEntity.scene.sceneData.sceneNumber + rootEntity.entityId).ToString();
 15125        if (rootEntity.gameObject != null)
 14126            isVisible = rootEntity.gameObject.activeSelf;
 127
 15128        isLoaded = false;
 15129        isShapeComponentSet = false;
 15130        InitRotation();
 131
 15132        isFloor = IsEntityAFloor();
 15133        isNFT = IsEntityNFT();
 134
 15135        if (rootEntity.meshRootGameObject && rootEntity.meshesInfo.renderers.Length > 0)
 136        {
 0137            ShapeInit();
 138        }
 15139    }
 140
 141    public CatalogItem GetCatalogItemAssociated()
 142    {
 20143        if (associatedCatalogItem != null)
 0144            return associatedCatalogItem;
 145
 20146        if (rootEntity == null)
 1147            return null;
 148
 149        //We get the catalog reference
 19150        IAssetCatalogReferenceHolder catalogHolder = rootEntity.scene.componentsManagerLegacy.TryGetComponent<IAssetCata
 19151        if (catalogHolder == null)
 6152            return null;
 153
 154        //we get the assetId to search in the catalog for the item
 13155        string assetId = catalogHolder.GetAssetId();
 156
 157        //We try to get the item from the main catalog that is usable right now
 13158        if (!string.IsNullOrEmpty(assetId) && DataStore.i.builderInWorld.catalogItemDict.TryGetValue(assetId, out associ
 0159            return associatedCatalogItem;
 160
 161        //If the item doesn't exist in the catalog, we fallback to the catalog of the scene
 13162        if (!string.IsNullOrEmpty(assetId) && DataStore.i.builderInWorld.currentSceneCatalogItemDict.TryGetValue(assetId
 0163            return associatedCatalogItem;
 164
 165        //Error 404: Item not found, we show a pink box to represent the item
 13166        return null;
 167    }
 168
 0169    public bool HasShape() { return isShapeComponentSet; }
 170
 0171    public bool HasMovedSinceLastReport() { return Vector3.Distance(lastPositionReported, rootEntity.gameObject.transfor
 172
 0173    public bool HasScaledSinceLastReport() { return Math.Abs(lastScaleReported.magnitude - rootEntity.gameObject.transfo
 174
 0175    public bool HasRotatedSinceLastReport() { return Quaternion.Angle(lastRotationReported, rootEntity.gameObject.transf
 176
 0177    public void PositionReported() { lastPositionReported = rootEntity.gameObject.transform.position; }
 178
 0179    public void ScaleReported() { lastScaleReported = rootEntity.gameObject.transform.lossyScale; }
 180
 0181    public void RotationReported() { lastRotationReported = rootEntity.gameObject.transform.rotation; }
 182
 183    #region Error Handling
 184
 185    public void CheckErrors()
 186    {
 4187        bool isCurrentlyWithError = false;
 188
 189        //If the entity doesn't have a catalog item associated, we can be sure that the item is deleted
 4190        if (GetCatalogItemAssociated() == null)
 191        {
 4192            hasMissingCatalogItemError = true;
 4193            isCurrentlyWithError = true;
 194        }
 195
 196        //If entity is not inside boundaries it has an error
 4197        if (isInsideBoundariesError)
 2198            isCurrentlyWithError = true;
 199
 4200        if (isCurrentlyWithError != hasError)
 201        {
 2202            hasError = isCurrentlyWithError;
 2203            OnErrorStatusChange?.Invoke(this);
 204        }
 2205    }
 206
 207    public void SetEntityBoundariesError(bool isInsideBoundaries)
 208    {
 4209        isInsideBoundariesError = !isInsideBoundaries;
 4210        CheckErrors();
 4211    }
 212
 213    #endregion
 214
 215    public void Select()
 216    {
 0217        isSelected = true;
 0218        originalParent = rootEntity.gameObject.transform.parent;
 0219        SetEditMaterial();
 0220        lastPositionReported = rootEntity.gameObject.transform.position;
 0221        lastScaleReported = rootEntity.gameObject.transform.lossyScale;
 0222        lastRotationReported = rootEntity.gameObject.transform.rotation;
 0223    }
 224
 225    public void Deselect()
 226    {
 0227        if (!isSelected)
 0228            return;
 229
 0230        isNew = false;
 0231        isSelected = false;
 0232        if (rootEntity.gameObject != null)
 0233            rootEntity.gameObject.transform.SetParent(originalParent);
 234
 0235        SetOriginalMaterials();
 0236    }
 237
 238    public void ToggleShowStatus()
 239    {
 0240        rootEntity.gameObject.SetActive(!rootEntity.gameObject.activeSelf);
 0241        isVisible = rootEntity.gameObject.activeSelf;
 0242        OnStatusUpdate?.Invoke(this);
 0243    }
 244
 0245    public void ToggleLockStatus() { isLocked = !isLocked; }
 246
 0247    public void ShapeLoadFinish(ISharedComponent component) { OnShapeFinishLoading?.Invoke(this); }
 248
 249    public void Delete()
 250    {
 0251        Deselect();
 0252        Dispose();
 0253        isDeleted = true;
 0254        OnDelete?.Invoke(this);
 0255    }
 256
 257    public void Dispose()
 258    {
 0259        if (rootEntity != null)
 260        {
 0261            rootEntity.OnShapeUpdated -= OnShapeUpdate;
 0262            rootEntity.OnNameChange -= OnNameUpdate;
 263
 0264            if (isNFT)
 265            {
 0266                if (rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.NFT_SHAPE, out I
 267                {
 0268                    BIWNFTController.i.StopUsingNFT(((NFTShape.Model) component.GetModel()).assetId);
 269                }
 270            }
 271
 0272            DCL.Environment.i.world.sceneBoundsChecker?.RunEntityEvaluation(rootEntity);
 0273            DCL.Environment.i.world.sceneBoundsChecker?.RemoveEntity(rootEntity, true, true);
 274        }
 275
 0276        DestroyColliders();
 277
 0278        associatedCatalogItem = null;
 0279    }
 280
 281    public void DestroyColliders()
 282    {
 0283        foreach (List<GameObject> entityColliderGameObject in collidersGameObjectDictionary.Values)
 284        {
 0285            for (int i = 0; i < entityColliderGameObject.Count; i++)
 286            {
 0287                GameObject.Destroy(entityColliderGameObject[i]);
 288            }
 289        }
 290
 0291        collidersGameObjectDictionary.Clear();
 0292    }
 293
 294    #region Components
 295
 296    #region Transfrom
 297
 2298    public void AddRotation(Vector3 newRotation) { currentRotation += newRotation; }
 299
 0300    public void SetRotation(Vector3 newRotation) { currentRotation = newRotation; }
 301
 2302    public Vector3 GetEulerRotation() { return currentRotation; }
 303
 304    public void InitRotation()
 305    {
 306        //TODO : We need to implement the initial rotation from the transform component instead of getting the current r
 15307        if (rootEntity.gameObject != null)
 14308            currentRotation = rootEntity.gameObject.transform.eulerAngles;
 15309    }
 310
 311    #endregion
 312
 313    #region SmartItem
 314
 315    public bool HasSmartItemComponent()
 316    {
 5317        if (rootEntity == null)
 1318            return false;
 319
 4320        return rootEntity.scene.componentsManagerLegacy.HasComponent(rootEntity, CLASS_ID_COMPONENT.SMART_ITEM);
 321    }
 322
 0323    public bool HasSmartItemActions() { return GetCatalogItemAssociated().HasActions(); }
 324
 0325    public SmartItemParameter[] GetSmartItemParameters() { return GetCatalogItemAssociated().parameters; }
 326
 0327    public SmartItemAction[] GetSmartItemActions() { return GetCatalogItemAssociated().actions; }
 328
 329    #endregion
 330
 331    #region Locked
 332
 333    public bool GetIsLockedValue()
 334    {
 1335        if (rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.LOCKED_ON_EDIT, out ISha
 336        {
 0337            return ((DCLLockedOnEdit.Model) component.GetModel()).isLocked;
 338        }
 339
 1340        return isFloor;
 341    }
 342
 343    public void SetIsLockedValue(bool isLocked)
 344    {
 0345        if (rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.LOCKED_ON_EDIT, out ISha
 346        {
 0347            ((DCLLockedOnEdit) component).SetIsLocked(isLocked);
 348        }
 349        else
 350        {
 0351            DCLLockedOnEdit.Model model = new DCLLockedOnEdit.Model();
 0352            model.isLocked = isLocked;
 353
 0354            EntityComponentsUtils.AddLockedOnEditComponent(rootEntity.scene , rootEntity, model, Guid.NewGuid().ToString
 355        }
 0356    }
 357
 358    #endregion
 359
 360    #region DescriptiveName
 361
 362    public void SetDescriptiveName(string newName)
 363    {
 0364        if (rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.NAME, out ISharedCompone
 365        {
 0366            ((DCLName) nameComponent).SetNewName(newName);
 367        }
 368        else
 369        {
 0370            DCLName.Model model = new DCLName.Model();
 0371            model.value = newName;
 0372            EntityComponentsUtils.AddNameComponent(rootEntity.scene , rootEntity,model, Guid.NewGuid().ToString());
 373        }
 374
 0375        OnStatusUpdate?.Invoke(this);
 0376    }
 377
 378    public string GetDescriptiveName()
 379    {
 1380        if (rootEntity != null && rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.NA
 381        {
 0382            return ((DCLName.Model) nameComponent.GetModel()).value;
 383        }
 384
 1385        return "";
 386    }
 387
 388    #endregion
 389
 390    #endregion
 391
 392    public void ResetTransfrom()
 393    {
 0394        currentRotation = Vector3.zero;
 0395        rootEntity.gameObject.transform.eulerAngles = currentRotation;
 0396        rootEntity.gameObject.transform.localScale = Vector3.one;
 0397        OnStatusUpdate?.Invoke(this);
 0398    }
 399
 400    void ShapeInit()
 401    {
 4402        isShapeComponentSet = true;
 403
 4404        CreateCollidersForEntity(rootEntity);
 405
 4406        if (isFloor)
 0407            isLocked = true;
 408
 4409        if (IsEntityAVoxel())
 0410            SetEntityAsVoxel();
 411
 4412        HandleAnimation();
 413
 4414        if (isNFT)
 415        {
 0416            if (rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.NFT_SHAPE, out IShar
 417            {
 0418                BIWNFTController.i.UseNFT(((NFTShape.Model) component.GetModel()).assetId);
 419            }
 420        }
 421
 4422        SaveOriginalMaterial();
 423
 4424        DCL.Environment.i.world.sceneBoundsChecker.AddEntityToBeChecked(rootEntity, true, true);
 4425        SetEntityBoundariesError(DCL.Environment.i.world.sceneBoundsChecker.IsEntityMeshInsideSceneBoundaries(rootEntity
 426
 4427        isLoaded = true;
 4428    }
 429
 430    private void HandleAnimation()
 431    {
 432        // We don't want animation to be running on editor
 4433        meshAnimations = rootEntity.gameObject.GetComponentsInChildren<Animation>();
 4434        if (HasSmartItemComponent())
 435        {
 0436            DefaultAnimationStop();
 437        }
 438        else
 439        {
 4440            DefaultAnimationSample(0);
 441        }
 4442    }
 443
 444    private void DefaultAnimationStop()
 445    {
 0446        if (meshAnimations == null)
 0447            return;
 448
 0449        for (int i = 0; i < meshAnimations.Length; i++)
 450        {
 0451            meshAnimations[i].Stop();
 452        }
 0453    }
 454
 455    private void DefaultAnimationSample(float time)
 456    {
 4457        if (meshAnimations == null || meshAnimations.Length == 0)
 4458            return;
 459
 0460        for (int i = 0; i < meshAnimations.Length; i++)
 461        {
 0462            meshAnimations[i].Stop();
 0463            meshAnimations[i].clip?.SampleAnimation(meshAnimations[i].gameObject, time);
 464        }
 0465    }
 466
 467    void SetOriginalMaterials()
 468    {
 0469        if (rootEntity.meshesInfo.renderers == null)
 0470            return;
 0471        if (isNFT)
 0472            return;
 473
 0474        int matCont = 0;
 0475        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 476        {
 0477            if (renderer == null)
 478                continue;
 0479            Material[] materials = new Material[renderer.sharedMaterials.Length];
 480
 0481            for (int i = 0; i < renderer.sharedMaterials.Length; i++)
 482            {
 0483                if (isNFT && matCont == 0)
 484                {
 0485                    materials[i] = renderer.sharedMaterials[i];
 0486                    matCont++;
 0487                    continue;
 488                }
 489
 0490                materials[i] = originalMaterials[matCont];
 0491                matCont++;
 492            }
 493
 0494            renderer.sharedMaterials = materials;
 495        }
 0496    }
 497
 498    void SetEntityAsVoxel()
 499    {
 0500        isVoxel = true;
 0501        rootEntity.gameObject.tag = BIWSettings.VOXEL_TAG;
 0502    }
 503
 504    void SaveOriginalMaterial()
 505    {
 4506        if (rootEntity.meshesInfo == null ||
 507            rootEntity.meshesInfo.renderers == null ||
 508            rootEntity.meshesInfo.renderers.Length == 0)
 2509            return;
 510
 2511        if (isNFT)
 0512            return;
 513
 2514        int totalMaterials = 0;
 8515        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 516        {
 2517            if (renderer == null)
 518                continue;
 2519            totalMaterials += renderer.sharedMaterials.Length;
 520        }
 521
 2522        if (!isNFT || (isNFT && originalMaterials == null))
 2523            originalMaterials = new Material[totalMaterials];
 524
 2525        int matCont = 0;
 8526        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 527        {
 2528            if (renderer == null)
 529                continue;
 530
 8531            for (int i = 0; i < renderer.sharedMaterials.Length; i++)
 532            {
 2533                if (isNFT && matCont == 0)
 534                {
 0535                    matCont++;
 0536                    continue;
 537                }
 538
 2539                originalMaterials[matCont] = renderer.sharedMaterials[i];
 2540                matCont++;
 541            }
 542        }
 2543    }
 544
 545    void SetEditMaterial()
 546    {
 0547        if (rootEntity.meshesInfo == null ||
 548            rootEntity.meshesInfo.renderers == null ||
 549            rootEntity.meshesInfo.renderers.Length < 1)
 0550            return;
 551
 0552        if (isNFT)
 0553            return;
 554
 0555        int matCont = 0;
 0556        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 557        {
 0558            if (renderer == null)
 559                continue;
 560
 0561            Material[] materials = new Material[renderer.sharedMaterials.Length];
 562
 0563            for (int i = 0; i < renderer.sharedMaterials.Length; i++)
 564            {
 0565                if (isNFT && matCont == 0)
 566                {
 0567                    materials[i] = renderer.sharedMaterials[i];
 0568                    matCont++;
 0569                    continue;
 570                }
 571
 0572                materials[i] = editMaterial;
 0573                matCont++;
 574            }
 575
 0576            renderer.sharedMaterials = materials;
 577        }
 0578    }
 579
 0580    void OnNameUpdate(object model) { OnStatusUpdate?.Invoke(this); }
 581
 582    void OnShapeUpdate(IDCLEntity entity)
 583    {
 4584        ShapeInit();
 585
 4586        if (isSelected)
 0587            SetEditMaterial();
 4588    }
 589
 590    void CreateCollidersForEntity(IDCLEntity entity)
 591    {
 4592        MeshesInfo meshInfo = entity.meshesInfo;
 4593        if (meshInfo == null ||
 594            meshInfo.currentShape == null ||
 595            !meshInfo.currentShape.IsVisible())
 2596            return;
 597
 2598        if (collidersGameObjectDictionary.ContainsKey((entity.scene.sceneData.sceneNumber + entity.entityId).ToString())
 0599            return;
 600
 2601        if (entity.children.Count > 0)
 602        {
 0603            using (var iterator = entity.children.GetEnumerator())
 604            {
 0605                while (iterator.MoveNext())
 606                {
 0607                    CreateCollidersForEntity(iterator.Current.Value);
 608                }
 0609            }
 610        }
 611
 612        //Note: When we are duplicating the GLTF and NFT component, their colliders are duplicated too
 613        //So we eliminate any previous collider to ensure that only 1 collider remain active
 2614        Transform[] children = rootEntity.gameObject.transform.GetComponentsInChildren<Transform>();
 24615        foreach (Transform child in children)
 616        {
 10617            if (child.gameObject.layer ==  BIWSettings.COLLIDER_SELECTION_LAYER)
 618            {
 0619                GameObject.Destroy(child.gameObject);
 620            }
 621        }
 622
 2623        List<GameObject> colliderList = new List<GameObject>();
 624
 8625        for (int i = 0; i < meshInfo.renderers.Length; i++)
 626        {
 2627            if (meshInfo.renderers[i] == null)
 628                continue;
 2629            GameObject entityColliderChildren = new GameObject(entity.entityId.ToString());
 2630            entityColliderChildren.layer = BIWSettings.COLLIDER_SELECTION_LAYER_INDEX;
 631
 2632            Transform t = entityColliderChildren.transform;
 2633            t.SetParent(meshInfo.renderers[i].transform);
 2634            t.ResetLocalTRS();
 635
 2636            var meshCollider = entityColliderChildren.AddComponent<MeshCollider>();
 637
 2638            if (meshInfo.renderers[i] is SkinnedMeshRenderer skr)
 639            {
 0640                Mesh meshColliderForSkinnedMesh = new Mesh();
 0641                skr.BakeMesh(meshColliderForSkinnedMesh);
 0642                meshCollider.sharedMesh = meshColliderForSkinnedMesh;
 0643                t.localScale = new Vector3(1 / meshInfo.renderers[i].gameObject.transform.lossyScale.x, 1 / meshInfo.ren
 644            }
 645            else
 646            {
 2647                meshCollider.sharedMesh = meshInfo.renderers[i].GetComponent<MeshFilter>().sharedMesh;
 648            }
 649
 2650            meshCollider.enabled = true;
 2651            colliderList.Add(entityColliderChildren);
 652
 2653            if (isNFT)
 654            {
 0655                string entityUniqueId = (entity.scene.sceneData.sceneNumber + entity.entityId).ToString();
 0656                if (collidersGameObjectDictionary.ContainsKey(entityUniqueId))
 0657                    collidersGameObjectDictionary.Remove(entityUniqueId);
 658
 0659                collidersGameObjectDictionary.Add(entityUniqueId, colliderList);
 660
 0661                colliderList = new List<GameObject>();
 662            }
 663        }
 664
 2665        if (!isNFT)
 2666            collidersGameObjectDictionary.Add((entity.scene.sceneData.sceneNumber + entity.entityId).ToString(), collide
 2667    }
 668
 669    public bool IsEntityNFT()
 670    {
 15671        return rootEntity.scene.componentsManagerLegacy.HasSharedComponent(rootEntity, CLASS_ID.NFT_SHAPE);
 672    }
 673
 15674    private bool IsEntityAFloor() { return GetCatalogItemAssociated()?.category == BIWSettings.FLOOR_CATEGORY; }
 675
 676    private bool IsEntityAVoxel()
 677    {
 4678        if (rootEntity.meshesInfo?.currentShape == null)
 2679            return false;
 2680        if (rootEntity.meshesInfo.renderers?.Length <= 0)
 0681            return false;
 2682        if (rootEntity.meshesInfo.mergedBounds.size != Vector3.one)
 2683            return false;
 0684        return true;
 685    }
 686}

Methods/Properties

gameObject()
transform()
rootEntity(DCL.Models.IDCLEntity)
rootEntity()
isDeleted()
isDeleted(System.Boolean)
isLocked()
isLocked(System.Boolean)
isSelected()
isSelected(System.Boolean)
isNew()
isNew(System.Boolean)
BIWEntity()
isVisible()
isVisible(System.Boolean)
isLoaded()
isLoaded(System.Boolean)
isVoxel()
isVoxel(System.Boolean)
isFloor()
isFloor(System.Boolean)
isNFT()
isNFT(System.Boolean)
hasError()
hasError(System.Boolean)
hasMissingCatalogItemError()
hasMissingCatalogItemError(System.Boolean)
isInsideBoundariesError()
isInsideBoundariesError(System.Boolean)
Initialize(DCL.Models.IDCLEntity, UnityEngine.Material)
GetCatalogItemAssociated()
HasShape()
HasMovedSinceLastReport()
HasScaledSinceLastReport()
HasRotatedSinceLastReport()
PositionReported()
ScaleReported()
RotationReported()
CheckErrors()
SetEntityBoundariesError(System.Boolean)
Select()
Deselect()
ToggleShowStatus()
ToggleLockStatus()
ShapeLoadFinish(DCL.Components.ISharedComponent)
Delete()
Dispose()
DestroyColliders()
AddRotation(UnityEngine.Vector3)
SetRotation(UnityEngine.Vector3)
GetEulerRotation()
InitRotation()
HasSmartItemComponent()
HasSmartItemActions()
GetSmartItemParameters()
GetSmartItemActions()
GetIsLockedValue()
SetIsLockedValue(System.Boolean)
SetDescriptiveName(System.String)
GetDescriptiveName()
ResetTransfrom()
ShapeInit()
HandleAnimation()
DefaultAnimationStop()
DefaultAnimationSample(System.Single)
SetOriginalMaterials()
SetEntityAsVoxel()
SaveOriginalMaterial()
SetEditMaterial()
OnNameUpdate(System.Object)
OnShapeUpdate(DCL.Models.IDCLEntity)
CreateCollidersForEntity(DCL.Models.IDCLEntity)
IsEntityNFT()
IsEntityAFloor()
IsEntityAVoxel()