< Summary

Class:BIWEntity
Assembly:BuilderEntity
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BuilderEntity/BIWEntity.cs
Covered lines:198
Uncovered lines:105
Coverable lines:303
Total lines:685
Line coverage:65.3% (198 of 303)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BIWEntity()0%110100%
Initialize(...)0%440100%
GetCatalogItemAssociated()0%8.038092.31%
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%110100%
Deselect()0%330100%
ToggleShowStatus()0%2.062075%
ToggleLockStatus()0%110100%
ShapeLoadFinish(...)0%2.52050%
Delete()0%220100%
Dispose()0%6.226081.82%
DestroyColliders()0%330100%
AddRotation(...)0%2100%
SetRotation(...)0%2100%
GetEulerRotation()0%2100%
InitRotation()0%220100%
HasSmartItemComponent()0%220100%
HasSmartItemActions()0%2100%
GetSmartItemParameters()0%2100%
GetSmartItemActions()0%2100%
GetIsLockedValue()0%220100%
SetIsLockedValue(...)0%220100%
SetDescriptiveName(...)0%3.473062.5%
GetDescriptiveName()0%330100%
ResetTransfrom()0%6200%
ShapeInit()0%5.25080%
HandleAnimation()0%2.152066.67%
DefaultAnimationStop()0%12300%
DefaultAnimationSample(...)0%15.555025%
SetOriginalMaterials()0%26.978033.33%
SetEntityAsVoxel()0%2100%
SaveOriginalMaterial()0%15.3515088.46%
SetEditMaterial()0%84.071009.52%
OnNameUpdate(...)0%2.52050%
OnShapeUpdate(...)0%220100%
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{
 114    public GameObject gameObject => rootEntity.gameObject;
 015    public Transform transform => rootEntity.gameObject.transform;
 16
 017    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    {
 4329        get { return GetIsLockedValue(); }
 30        set
 31        {
 4032            SetIsLockedValue(value);
 4033            OnStatusUpdate?.Invoke(this);
 034        }
 35    }
 36
 37    private bool isSelectedValue = false;
 38
 39    public bool isSelected
 40    {
 041        get { return isSelectedValue; }
 42        set
 43        {
 3944            isSelectedValue = value;
 3945            OnStatusUpdate?.Invoke(this);
 046        }
 47    }
 48
 49    private bool isNewValue = false;
 50
 51    public bool isNew
 52    {
 053        get { return isNewValue; }
 54        set
 55        {
 9956            isNewValue = value;
 9957            OnStatusUpdate?.Invoke(this);
 058        }
 59    }
 60
 13061    private bool isVisibleValue = true;
 62
 63    public bool isVisible
 64    {
 065        get { return isVisibleValue; }
 66        set
 67        {
 14168            isVisibleValue = value;
 69
 14170            if (rootEntity != null && rootEntity.gameObject != null)
 71            {
 13972                rootEntity.gameObject.SetActive(isVisibleValue);
 73            }
 74
 14175            OnStatusUpdate?.Invoke(this);
 076        }
 77    }
 78
 079    public bool isLoaded { get; internal set; } = false;
 80
 081    public bool isVoxel { get; set; } = false;
 82
 83    private CatalogItem associatedCatalogItem;
 84
 085    public bool isFloor { get; set; } = false;
 086    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
 13099    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
 0107    public bool hasError  { get; private set; } = false;
 108
 0109    public bool hasMissingCatalogItemError { get; private set; } = false;
 0110    public bool isInsideBoundariesError { get; private set; } = false;
 111
 112    #endregion
 113
 114    public void Initialize(IDCLEntity entity, Material editMaterial)
 115    {
 104116        rootEntity = entity;
 104117        rootEntity.OnShapeUpdated += OnShapeUpdate;
 104118        rootEntity.OnNameChange += OnNameUpdate;
 119
 104120        this.editMaterial = editMaterial;
 104121        isVoxel = false;
 122
 123
 104124        entityUniqueId = rootEntity.scene.sceneData.id + rootEntity.entityId;
 104125        if (rootEntity.gameObject != null)
 103126            isVisible = rootEntity.gameObject.activeSelf;
 127
 104128        isLoaded = false;
 104129        isShapeComponentSet = false;
 104130        InitRotation();
 131
 104132        isFloor = IsEntityAFloor();
 104133        isNFT = IsEntityNFT();
 134
 104135        if (rootEntity.meshRootGameObject && rootEntity.meshesInfo.renderers.Length > 0)
 136        {
 6137            ShapeInit();
 138        }
 104139    }
 140
 141    public CatalogItem GetCatalogItemAssociated()
 142    {
 282143        if (associatedCatalogItem != null)
 8144            return associatedCatalogItem;
 145
 274146        if (rootEntity == null)
 1147            return null;
 148
 149        //We get the catalog reference
 273150        IAssetCatalogReferenceHolder catalogHolder = rootEntity.scene.componentsManagerLegacy.TryGetComponent<IAssetCata
 273151        if (catalogHolder == null)
 222152            return null;
 153
 154        //we get the assetId to search in the catalog for the item
 51155        string assetId = catalogHolder.GetAssetId();
 156
 157        //We try to get the item from the main catalog that is usable right now
 51158        if (!string.IsNullOrEmpty(assetId) && DataStore.i.builderInWorld.catalogItemDict.TryGetValue(assetId, out associ
 9159            return associatedCatalogItem;
 160
 161        //If the item doesn't exist in the catalog, we fallback to the catalog of the scene
 42162        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
 42166        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    {
 85187        bool isCurrentlyWithError = false;
 188
 189        //If the entity doesn't have a catalog item associated, we can be sure that the item is deleted
 85190        if (GetCatalogItemAssociated() == null)
 191        {
 78192            hasMissingCatalogItemError = true;
 78193            isCurrentlyWithError = true;
 194        }
 195
 196        //If entity is not inside boundaries it has an error
 85197        if (isInsideBoundariesError)
 25198            isCurrentlyWithError = true;
 199
 85200        if (isCurrentlyWithError != hasError)
 201        {
 64202            hasError = isCurrentlyWithError;
 64203            OnErrorStatusChange?.Invoke(this);
 204        }
 21205    }
 206
 207    public void SetEntityBoundariesError(bool isInsideBoundaries)
 208    {
 37209        isInsideBoundariesError = !isInsideBoundaries;
 37210        CheckErrors();
 37211    }
 212
 213    #endregion
 214
 215    public void Select()
 216    {
 26217        isSelected = true;
 26218        originalParent = rootEntity.gameObject.transform.parent;
 26219        SetEditMaterial();
 26220        lastPositionReported = rootEntity.gameObject.transform.position;
 26221        lastScaleReported = rootEntity.gameObject.transform.lossyScale;
 26222        lastRotationReported = rootEntity.gameObject.transform.rotation;
 26223    }
 224
 225    public void Deselect()
 226    {
 25227        if (!isSelected)
 12228            return;
 229
 13230        isNew = false;
 13231        isSelected = false;
 13232        if (rootEntity.gameObject != null)
 13233            rootEntity.gameObject.transform.SetParent(originalParent);
 234
 13235        SetOriginalMaterials();
 13236    }
 237
 238    public void ToggleShowStatus()
 239    {
 3240        rootEntity.gameObject.SetActive(!rootEntity.gameObject.activeSelf);
 3241        isVisible = rootEntity.gameObject.activeSelf;
 3242        OnStatusUpdate?.Invoke(this);
 0243    }
 244
 6245    public void ToggleLockStatus() { isLocked = !isLocked; }
 246
 1247    public void ShapeLoadFinish(ISharedComponent component) { OnShapeFinishLoading?.Invoke(this); }
 248
 249    public void Delete()
 250    {
 13251        Deselect();
 13252        Dispose();
 13253        isDeleted = true;
 13254        OnDelete?.Invoke(this);
 1255    }
 256
 257    public void Dispose()
 258    {
 13259        if (rootEntity != null)
 260        {
 13261            rootEntity.OnShapeUpdated -= OnShapeUpdate;
 13262            rootEntity.OnNameChange -= OnNameUpdate;
 263
 13264            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
 13272            DCL.Environment.i.world.sceneBoundsChecker?.RunEntityEvaluation(rootEntity);
 13273            DCL.Environment.i.world.sceneBoundsChecker?.RemoveEntity(rootEntity, true, true);
 274        }
 275
 13276        DestroyColliders();
 277
 13278        associatedCatalogItem = null;
 13279    }
 280
 281    public void DestroyColliders()
 282    {
 160283        foreach (List<GameObject> entityColliderGameObject in collidersGameObjectDictionary.Values)
 284        {
 42285            for (int i = 0; i < entityColliderGameObject.Count; i++)
 286            {
 12287                GameObject.Destroy(entityColliderGameObject[i]);
 288            }
 289        }
 290
 71291        collidersGameObjectDictionary.Clear();
 71292    }
 293
 294    #region Components
 295
 296    #region Transfrom
 297
 0298    public void AddRotation(Vector3 newRotation) { currentRotation += newRotation; }
 299
 0300    public void SetRotation(Vector3 newRotation) { currentRotation = newRotation; }
 301
 0302    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
 104307        if (rootEntity.gameObject != null)
 103308            currentRotation = rootEntity.gameObject.transform.eulerAngles;
 104309    }
 310
 311    #endregion
 312
 313    #region SmartItem
 314
 315    public bool HasSmartItemComponent()
 316    {
 38317        if (rootEntity == null)
 1318            return false;
 319
 37320        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    {
 43335        if (rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.LOCKED_ON_EDIT, out ISha
 336        {
 18337            return ((DCLLockedOnEdit.Model) component.GetModel()).isLocked;
 338        }
 339
 25340        return isFloor;
 341    }
 342
 343    public void SetIsLockedValue(bool isLocked)
 344    {
 42345        if (rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.LOCKED_ON_EDIT, out ISha
 346        {
 7347            ((DCLLockedOnEdit) component).SetIsLocked(isLocked);
 7348        }
 349        else
 350        {
 35351            DCLLockedOnEdit.Model model = new DCLLockedOnEdit.Model();
 35352            model.isLocked = isLocked;
 353
 35354            EntityComponentsUtils.AddLockedOnEditComponent(rootEntity.scene , rootEntity, model, Guid.NewGuid().ToString
 355        }
 35356    }
 357
 358    #endregion
 359
 360    #region DescriptiveName
 361
 362    public void SetDescriptiveName(string newName)
 363    {
 19364        if (rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.NAME, out ISharedCompone
 365        {
 0366            ((DCLName) nameComponent).SetNewName(newName);
 0367        }
 368        else
 369        {
 19370            DCLName.Model model = new DCLName.Model();
 19371            model.value = newName;
 19372            EntityComponentsUtils.AddNameComponent(rootEntity.scene , rootEntity,model, Guid.NewGuid().ToString());
 373        }
 374
 19375        OnStatusUpdate?.Invoke(this);
 0376    }
 377
 378    public string GetDescriptiveName()
 379    {
 116380        if (rootEntity != null && rootEntity.scene.componentsManagerLegacy.TryGetSharedComponent(rootEntity, CLASS_ID.NA
 381        {
 7382            return ((DCLName.Model) nameComponent.GetModel()).value;
 383        }
 384
 109385        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    {
 36402        isShapeComponentSet = true;
 403
 36404        CreateCollidersForEntity(rootEntity);
 405
 36406        if (isFloor)
 3407            isLocked = true;
 408
 36409        if (IsEntityAVoxel())
 0410            SetEntityAsVoxel();
 411
 36412        HandleAnimation();
 413
 36414        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
 36422        SaveOriginalMaterial();
 423
 36424        DCL.Environment.i.world.sceneBoundsChecker.AddEntityToBeChecked(rootEntity, true, true);
 36425        SetEntityBoundariesError(DCL.Environment.i.world.sceneBoundsChecker.IsEntityMeshInsideSceneBoundaries(rootEntity
 426
 36427        isLoaded = true;
 36428    }
 429
 430    private void HandleAnimation()
 431    {
 432        // We don't want animation to be running on editor
 36433        meshAnimations = rootEntity.gameObject.GetComponentsInChildren<Animation>();
 36434        if (HasSmartItemComponent())
 435        {
 0436            DefaultAnimationStop();
 0437        }
 438        else
 439        {
 36440            DefaultAnimationSample(0);
 441        }
 36442    }
 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    {
 36457        if (meshAnimations == null || meshAnimations.Length == 0)
 36458            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    {
 13469        if (rootEntity.meshesInfo.renderers == null)
 12470            return;
 1471        if (isNFT)
 0472            return;
 473
 1474        int matCont = 0;
 2475        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        }
 1496    }
 497
 498    void SetEntityAsVoxel()
 499    {
 0500        isVoxel = true;
 0501        rootEntity.gameObject.tag = BIWSettings.VOXEL_TAG;
 0502    }
 503
 504    void SaveOriginalMaterial()
 505    {
 36506        if (rootEntity.meshesInfo == null ||
 507            rootEntity.meshesInfo.renderers == null ||
 508            rootEntity.meshesInfo.renderers.Length == 0)
 22509            return;
 510
 14511        if (isNFT)
 0512            return;
 513
 14514        int totalMaterials = 0;
 74515        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 516        {
 23517            if (renderer == null)
 518                continue;
 23519            totalMaterials += renderer.sharedMaterials.Length;
 520        }
 521
 14522        if (!isNFT || (isNFT && originalMaterials == null))
 14523            originalMaterials = new Material[totalMaterials];
 524
 14525        int matCont = 0;
 74526        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 527        {
 23528            if (renderer == null)
 529                continue;
 530
 104531            for (int i = 0; i < renderer.sharedMaterials.Length; i++)
 532            {
 29533                if (isNFT && matCont == 0)
 534                {
 0535                    matCont++;
 0536                    continue;
 537                }
 538
 29539                originalMaterials[matCont] = renderer.sharedMaterials[i];
 29540                matCont++;
 541            }
 542        }
 14543    }
 544
 545    void SetEditMaterial()
 546    {
 33547        if (rootEntity.meshesInfo == null ||
 548            rootEntity.meshesInfo.renderers == null ||
 549            rootEntity.meshesInfo.renderers.Length < 1)
 33550            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
 1580    void OnNameUpdate(object model) { OnStatusUpdate?.Invoke(this); }
 581
 582    void OnShapeUpdate(IDCLEntity entity)
 583    {
 30584        ShapeInit();
 585
 30586        if (isSelected)
 7587            SetEditMaterial();
 30588    }
 589
 590    void CreateCollidersForEntity(IDCLEntity entity)
 591    {
 36592        MeshesInfo meshInfo = entity.meshesInfo;
 36593        if (meshInfo == null ||
 594            meshInfo.currentShape == null ||
 595            !meshInfo.currentShape.IsVisible())
 22596            return;
 597
 14598        if (collidersGameObjectDictionary.ContainsKey(entity.scene.sceneData.id + entity.entityId) && !isNFT)
 0599            return;
 600
 14601        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
 14614        Transform[] children = rootEntity.gameObject.transform.GetComponentsInChildren<Transform>();
 160615        foreach (Transform child in children)
 616        {
 66617            if (child.gameObject.layer ==  BIWSettings.COLLIDER_SELECTION_LAYER)
 618            {
 0619                GameObject.Destroy(child.gameObject);
 620            }
 621        }
 622
 14623        List<GameObject> colliderList = new List<GameObject>();
 624
 74625        for (int i = 0; i < meshInfo.renderers.Length; i++)
 626        {
 23627            if (meshInfo.renderers[i] == null)
 628                continue;
 23629            GameObject entityColliderChildren = new GameObject(entity.entityId.ToString());
 23630            entityColliderChildren.layer = BIWSettings.COLLIDER_SELECTION_LAYER_INDEX;
 631
 23632            Transform t = entityColliderChildren.transform;
 23633            t.SetParent(meshInfo.renderers[i].transform);
 23634            t.ResetLocalTRS();
 635
 23636            var meshCollider = entityColliderChildren.AddComponent<MeshCollider>();
 637
 23638            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
 0644            }
 645            else
 646            {
 23647                meshCollider.sharedMesh = meshInfo.renderers[i].GetComponent<MeshFilter>().sharedMesh;
 648            }
 649
 23650            meshCollider.enabled = true;
 23651            colliderList.Add(entityColliderChildren);
 652
 23653            if (isNFT)
 654            {
 0655                if (collidersGameObjectDictionary.ContainsKey(entity.scene.sceneData.id + entity.entityId))
 0656                    collidersGameObjectDictionary.Remove(entity.scene.sceneData.id + entity.entityId);
 657
 0658                collidersGameObjectDictionary.Add(entity.scene.sceneData.id + entity.entityId, colliderList);
 659
 0660                colliderList = new List<GameObject>();
 661            }
 662        }
 663
 14664        if (!isNFT)
 14665            collidersGameObjectDictionary.Add(entity.scene.sceneData.id + entity.entityId, colliderList);
 14666    }
 667
 668    public bool IsEntityNFT()
 669    {
 105670        return rootEntity.scene.componentsManagerLegacy.HasSharedComponent(rootEntity, CLASS_ID.NFT_SHAPE);
 671    }
 672
 104673    private bool IsEntityAFloor() { return GetCatalogItemAssociated()?.category == BIWSettings.FLOOR_CATEGORY; }
 674
 675    private bool IsEntityAVoxel()
 676    {
 36677        if (rootEntity.meshesInfo?.currentShape == null)
 22678            return false;
 14679        if (rootEntity.meshesInfo.renderers?.Length <= 0)
 0680            return false;
 14681        if (rootEntity.meshesInfo.mergedBounds.size != Vector3.one)
 14682            return false;
 0683        return true;
 684    }
 685}

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()