< Summary

Class:DCLBuilderInWorldEntity
Assembly:BuilderEntity
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/BuilderMode/BuilderEntity/DCLBuilderInWorldEntity.cs
Covered lines:211
Uncovered lines:93
Coverable lines:304
Total lines:682
Line coverage:69.4% (211 of 304)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
DCLBuilderInWorldEntity()0%110100%
Init(...)0%330100%
GetCatalogItemAssociated()0%660100%
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%6200%
ToggleLockStatus()0%110100%
ShapeLoadFinish(...)0%6200%
Delete()0%220100%
Dispose()0%10.147060%
DestroyColliders()0%4.543044.44%
AddRotation(...)0%2100%
SetRotation(...)0%2100%
GetEulerRotation()0%2100%
InitRotation()0%110100%
HasSmartItemComponent()0%220100%
HasSmartItemActions()0%2100%
GetSmartItemParameters()0%2100%
GetSmartItemActions()0%2100%
GetIsLockedValue()0%330100%
SetIsLockedValue(...)0%440100%
SetDescriptiveName(...)0%3.013088.89%
GetDescriptiveName()0%330100%
ResetTransfrom()0%6200%
ShapeInit()0%66095%
HandleAnimation()0%2.152066.67%
DefaultAnimationStop()0%12300%
DefaultAnimationSample(...)0%550100%
SetOriginalMaterials()0%26.978033.33%
SetEntityAsVoxel()0%2100%
SaveOriginalMaterial()0%15.115092.31%
SetEditMaterial()0%84.071009.52%
OnNameUpdate(...)0%2.52050%
OnShapeUpdate(...)0%220100%
CreateCollidersForEntity(...)0%2016075%
IsEntityNFT()0%330100%
IsEntityAFloor()0%330100%
IsEntityAVoxel()0%8.198085.71%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/BuilderMode/BuilderEntity/DCLBuilderInWorldEntity.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 UnityEngine;
 10
 11public class DCLBuilderInWorldEntity : EditableEntity
 12{
 13    public string entityUniqueId;
 14
 15    public event Action<DCLBuilderInWorldEntity> OnShapeFinishLoading;
 16    public event Action<DCLBuilderInWorldEntity> OnStatusUpdate;
 17    public event Action<DCLBuilderInWorldEntity> OnDelete;
 18    public event Action<DCLBuilderInWorldEntity> OnErrorStatusChange;
 19
 20    public bool IsLocked
 21    {
 1722        get { return GetIsLockedValue(); }
 23        set
 24        {
 525            SetIsLockedValue(value);
 526            OnStatusUpdate?.Invoke(this);
 027        }
 28    }
 29
 30    private bool isSelectedValue = false;
 31
 32    public bool IsSelected
 33    {
 034        get { return isSelectedValue; }
 35        set
 36        {
 2137            isSelectedValue = value;
 2138            OnStatusUpdate?.Invoke(this);
 039        }
 40    }
 41
 42    private bool isNewValue = false;
 43
 44    public bool IsNew
 45    {
 046        get { return isNewValue; }
 47        set
 48        {
 5749            isNewValue = value;
 5750            OnStatusUpdate?.Invoke(this);
 051        }
 52    }
 53
 7254    private bool isVisibleValue = true;
 55
 56    public bool IsVisible
 57    {
 058        get { return isVisibleValue; }
 59        set
 60        {
 5061            isVisibleValue = value;
 5062            OnStatusUpdate?.Invoke(this);
 063        }
 64    }
 65
 066    public bool isVoxel { get; set; } = false;
 67
 68    CatalogItem associatedCatalogItem;
 69
 070    public bool isFloor { get; set; } = false;
 071    public bool isNFT { get; private set; } = false;
 72
 73    private bool isShapeComponentSet = false;
 74
 75    private Animation[] meshAnimations;
 76
 77    private Vector3 currentRotation;
 78    private Transform originalParent;
 79
 80    private Material[] originalMaterials;
 81
 82    private Material editMaterial;
 83
 7284    private Dictionary<string, List<GameObject>> collidersGameObjectDictionary = new Dictionary<string, List<GameObject>
 85
 86    private Vector3 lastPositionReported;
 87    private Vector3 lastScaleReported;
 88    private Quaternion lastRotationReported;
 89
 90    #region Error Handler definition
 91
 092    public bool hasError  { get; private set; } = false;
 93
 094    public bool hasMissingCatalogItemError { get; private set; } = false;
 095    public bool isInsideBoundariesError { get; private set; } = false;
 96
 97    #endregion
 98
 99    public void Init(IDCLEntity entity, Material editMaterial)
 100    {
 50101        rootEntity = entity;
 50102        rootEntity.OnShapeUpdated += OnShapeUpdate;
 50103        rootEntity.OnNameChange += OnNameUpdate;
 104
 50105        this.editMaterial = editMaterial;
 50106        isVoxel = false;
 107
 108
 50109        entityUniqueId = rootEntity.scene.sceneData.id + rootEntity.entityId;
 50110        IsVisible = rootEntity.gameObject.activeSelf;
 111
 50112        isShapeComponentSet = false;
 50113        InitRotation();
 114
 50115        if (rootEntity.meshRootGameObject && rootEntity.meshesInfo.renderers.Length > 0)
 116        {
 3117            ShapeInit();
 118        }
 50119    }
 120
 121    public CatalogItem GetCatalogItemAssociated()
 122    {
 118123        if (associatedCatalogItem != null)
 17124            return associatedCatalogItem;
 125
 101126        if (rootEntity == null)
 1127            return null;
 128
 100129        IAssetCatalogReferenceHolder catalogHolder = rootEntity.TryGetComponent<IAssetCatalogReferenceHolder>();
 100130        if (catalogHolder == null)
 77131            return null;
 132
 23133        string assetId = catalogHolder.GetAssetId();
 134
 23135        if (!string.IsNullOrEmpty(assetId) && DataStore.i.builderInWorld.catalogItemDict.TryGetValue(assetId, out associ
 9136            return associatedCatalogItem;
 137
 14138        return null;
 139    }
 140
 0141    public bool HasShape() { return isShapeComponentSet; }
 142
 0143    public bool HasMovedSinceLastReport() { return Vector3.Distance(lastPositionReported, transform.position) >= Builder
 144
 0145    public bool HasScaledSinceLastReport() { return Math.Abs(lastScaleReported.magnitude - transform.lossyScale.magnitud
 146
 0147    public bool HasRotatedSinceLastReport() { return Quaternion.Angle(lastRotationReported, transform.rotation) >= Build
 148
 0149    public void PositionReported() { lastPositionReported = transform.position; }
 150
 0151    public void ScaleReported() { lastScaleReported = transform.lossyScale; }
 152
 0153    public void RotationReported() { lastRotationReported = transform.rotation; }
 154
 155    #region Error Handling
 156
 157    public void CheckErrors()
 158    {
 39159        bool isCurrentlyWithError = false;
 160
 161        //If the entity doesn't have a catalog item associated, we can be sure that the item is deleted
 39162        if (GetCatalogItemAssociated() == null)
 163        {
 31164            hasMissingCatalogItemError = true;
 31165            isCurrentlyWithError = true;
 166        }
 167
 168        //If entity is not inside boundaries it has an error
 39169        if (isInsideBoundariesError)
 23170            isCurrentlyWithError = true;
 171
 39172        bool hasErrorPreviously = hasError;
 39173        hasError = isCurrentlyWithError;
 174
 39175        if (isCurrentlyWithError != hasErrorPreviously)
 31176            OnErrorStatusChange?.Invoke(this);
 8177    }
 178
 179    public void SetEntityBoundariesError(bool isInsideBoundaries)
 180    {
 21181        isInsideBoundariesError = !isInsideBoundaries;
 21182        CheckErrors();
 21183    }
 184
 185    #endregion
 186
 187    public void Select()
 188    {
 11189        IsSelected = true;
 11190        originalParent = rootEntity.gameObject.transform.parent;
 11191        SetEditMaterial();
 11192        lastPositionReported = transform.position;
 11193        lastScaleReported = transform.lossyScale;
 11194        lastRotationReported = transform.rotation;
 11195    }
 196
 197    public void Deselect()
 198    {
 18199        if (!IsSelected)
 8200            return;
 201
 10202        IsNew = false;
 10203        IsSelected = false;
 10204        if (rootEntity.gameObject != null)
 4205            rootEntity.gameObject.transform.SetParent(originalParent);
 206
 10207        SetOriginalMaterials();
 10208    }
 209
 210    public void ToggleShowStatus()
 211    {
 0212        rootEntity.gameObject.SetActive(!gameObject.activeSelf);
 0213        IsVisible = gameObject.activeSelf;
 0214        OnStatusUpdate?.Invoke(this);
 0215    }
 216
 2217    public void ToggleLockStatus() { IsLocked = !IsLocked; }
 218
 0219    public void ShapeLoadFinish(ISharedComponent component) { OnShapeFinishLoading?.Invoke(this); }
 220
 221    public void Delete()
 222    {
 8223        Deselect();
 8224        Dispose();
 8225        OnDelete?.Invoke(this);
 1226    }
 227
 228    public void Dispose()
 229    {
 8230        if (rootEntity != null)
 231        {
 8232            rootEntity.OnShapeUpdated -= OnShapeUpdate;
 8233            rootEntity.OnNameChange -= OnNameUpdate;
 234
 8235            if (isNFT)
 236            {
 0237                foreach (KeyValuePair<Type, ISharedComponent> kvp in rootEntity.sharedComponents)
 238                {
 0239                    if (kvp.Value.GetClassId() == (int) CLASS_ID.NFT_SHAPE)
 240                    {
 0241                        BuilderInWorldNFTController.i.StopUsingNFT(((NFTShape.Model) kvp.Value.GetModel()).assetId);
 0242                        break;
 243                    }
 244                }
 245            }
 246
 8247            DCL.Environment.i.world.sceneBoundsChecker?.EvaluateEntityPosition(rootEntity);
 8248            DCL.Environment.i.world.sceneBoundsChecker?.RemoveEntityToBeChecked(rootEntity);
 249        }
 250
 8251        DestroyColliders();
 252
 8253        associatedCatalogItem = null;
 8254    }
 255
 256    public void DestroyColliders()
 257    {
 16258        foreach (List<GameObject> entityColliderGameObject in collidersGameObjectDictionary.Values)
 259        {
 0260            for (int i = entityColliderGameObject.Count - 1; i > 0; i--)
 261            {
 0262                Destroy(entityColliderGameObject[i]);
 263            }
 264        }
 265
 8266        collidersGameObjectDictionary.Clear();
 8267    }
 268
 269    #region Components
 270
 271    #region Transfrom
 272
 0273    public void AddRotation(Vector3 newRotation) { currentRotation += newRotation; }
 274
 0275    public void SetRotation(Vector3 newRotation) { currentRotation = newRotation; }
 276
 0277    public Vector3 GetEulerRotation() { return currentRotation; }
 278
 279    public void InitRotation()
 280    {
 281        //TODO : We need to implement the initial rotation from the transform component instead of getting the current r
 50282        currentRotation = rootEntity.gameObject.transform.eulerAngles;
 50283    }
 284
 285    #endregion
 286
 287    #region SmartItem
 288
 289    public bool HasSmartItemComponent()
 290    {
 23291        if (rootEntity == null)
 1292            return false;
 293
 22294        return rootEntity.components.ContainsKey(CLASS_ID_COMPONENT.SMART_ITEM);
 295    }
 296
 0297    public bool HasSmartItemActions() { return GetCatalogItemAssociated().HasActions(); }
 298
 0299    public SmartItemParameter[] GetSmartItemParameters() { return GetCatalogItemAssociated().parameters; }
 300
 0301    public SmartItemAction[] GetSmartItemActions() { return GetCatalogItemAssociated().actions; }
 302
 303    #endregion
 304
 305    #region Locked
 306
 307    public bool GetIsLockedValue()
 308    {
 85309        foreach (KeyValuePair<Type, ISharedComponent> kvp in rootEntity.sharedComponents)
 310        {
 31311            if (kvp.Value.GetClassId() == (int) CLASS_ID.LOCKED_ON_EDIT)
 312            {
 11313                return ((DCLLockedOnEdit.Model) kvp.Value.GetModel()).isLocked;
 314            }
 315        }
 316
 6317        return isFloor;
 11318    }
 319
 320    public void SetIsLockedValue(bool isLocked)
 321    {
 7322        bool foundComponent = false;
 323
 34324        foreach (KeyValuePair<Type, ISharedComponent> kvp in rootEntity.sharedComponents)
 325        {
 10326            if (kvp.Value.GetClassId() == (int) CLASS_ID.LOCKED_ON_EDIT)
 327            {
 4328                ((DCLLockedOnEdit) kvp.Value).SetIsLocked(isLocked);
 4329                foundComponent = true;
 330            }
 331        }
 332
 7333        if (!foundComponent)
 334        {
 3335            ParcelScene scene = rootEntity.scene as ParcelScene;
 3336            DCLLockedOnEdit entityLocked = (DCLLockedOnEdit) scene.SharedComponentCreate(Guid.NewGuid().ToString(), Conv
 3337            entityLocked.SetIsLocked(isLocked);
 3338            scene.SharedComponentAttach(rootEntity.entityId, entityLocked.id);
 339        }
 7340    }
 341
 342    #endregion
 343
 344    #region DescriptiveName
 345
 346    public void SetDescriptiveName(string newName)
 347    {
 19348        if (rootEntity.TryGetSharedComponent(CLASS_ID.NAME, out ISharedComponent nameComponent))
 349        {
 15350            ((DCLName) nameComponent).SetNewName(newName);
 15351        }
 352        else
 353        {
 4354            ParcelScene scene = rootEntity.scene as ParcelScene;
 4355            DCLName name = (DCLName) scene.SharedComponentCreate(Guid.NewGuid().ToString(), Convert.ToInt32(CLASS_ID.NAM
 4356            name.SetNewName(newName);
 4357            scene.SharedComponentAttach(rootEntity.entityId, name.id);
 358        }
 359
 19360        OnStatusUpdate?.Invoke(this);
 0361    }
 362
 363    public string GetDescriptiveName()
 364    {
 76365        if (rootEntity != null && rootEntity.TryGetSharedComponent(CLASS_ID.NAME, out ISharedComponent nameComponent))
 366        {
 22367            return ((DCLName.Model) nameComponent.GetModel()).value;
 368        }
 369
 54370        return "";
 371    }
 372
 373    #endregion
 374
 375    #endregion
 376
 377    public void ResetTransfrom()
 378    {
 0379        currentRotation = Vector3.zero;
 0380        rootEntity.gameObject.transform.eulerAngles = currentRotation;
 381
 0382        OnStatusUpdate?.Invoke(this);
 0383    }
 384
 385    void ShapeInit()
 386    {
 21387        isShapeComponentSet = true;
 388
 21389        isFloor = IsEntityAFloor();
 21390        isNFT = IsEntityNFT();
 391
 21392        CreateCollidersForEntity(rootEntity);
 393
 21394        if (isFloor)
 4395            IsLocked = true;
 396
 21397        if (IsEntityAVoxel())
 0398            SetEntityAsVoxel();
 399
 21400        HandleAnimation();
 401
 21402        if (isNFT)
 403        {
 3404            foreach (KeyValuePair<Type, ISharedComponent> keyValuePairBaseDisposable in rootEntity.sharedComponents)
 405            {
 1406                if (keyValuePairBaseDisposable.Value.GetClassId() == (int) CLASS_ID.NFT_SHAPE)
 407                {
 1408                    BuilderInWorldNFTController.i.UseNFT(((NFTShape.Model) keyValuePairBaseDisposable.Value.GetModel()).
 1409                    break;
 410                }
 411            }
 412        }
 413
 21414        SaveOriginalMaterial();
 415
 21416        DCL.Environment.i.world.sceneBoundsChecker.AddPersistent(rootEntity);
 21417        SetEntityBoundariesError(DCL.Environment.i.world.sceneBoundsChecker.IsEntityInsideSceneBoundaries(rootEntity));
 21418    }
 419
 420    private void HandleAnimation()
 421    {
 422        // We don't want animation to be running on editor
 21423        meshAnimations = rootEntity.gameObject.GetComponentsInChildren<Animation>();
 21424        if (HasSmartItemComponent())
 425        {
 0426            DefaultAnimationStop();
 0427        }
 428        else
 429        {
 21430            DefaultAnimationSample(0);
 431        }
 21432    }
 433
 434    private void DefaultAnimationStop()
 435    {
 0436        if (meshAnimations == null)
 0437            return;
 438
 0439        for (int i = 0; i < meshAnimations.Length; i++)
 440        {
 0441            meshAnimations[i].Stop();
 442        }
 0443    }
 444
 445    private void DefaultAnimationSample(float time)
 446    {
 21447        if (meshAnimations == null || meshAnimations.Length == 0)
 20448            return;
 449
 4450        for (int i = 0; i < meshAnimations.Length; i++)
 451        {
 1452            meshAnimations[i].Stop();
 1453            meshAnimations[i].clip?.SampleAnimation(meshAnimations[i].gameObject, time);
 454        }
 1455    }
 456
 457    void SetOriginalMaterials()
 458    {
 10459        if (rootEntity.meshesInfo.renderers == null)
 9460            return;
 1461        if (isNFT)
 0462            return;
 463
 1464        int matCont = 0;
 2465        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 466        {
 0467            if (renderer == null)
 468                continue;
 0469            Material[] materials = new Material[renderer.sharedMaterials.Length];
 470
 0471            for (int i = 0; i < renderer.sharedMaterials.Length; i++)
 472            {
 0473                if (isNFT && matCont == 0)
 474                {
 0475                    materials[i] = renderer.sharedMaterials[i];
 0476                    matCont++;
 0477                    continue;
 478                }
 479
 0480                materials[i] = originalMaterials[matCont];
 0481                matCont++;
 482            }
 483
 0484            renderer.sharedMaterials = materials;
 485        }
 1486    }
 487
 488    void SetEntityAsVoxel()
 489    {
 0490        isVoxel = true;
 0491        gameObject.tag = BuilderInWorldSettings.VOXEL_TAG;
 0492    }
 493
 494    void SaveOriginalMaterial()
 495    {
 21496        if (rootEntity.meshesInfo == null ||
 497            rootEntity.meshesInfo.renderers == null ||
 498            rootEntity.meshesInfo.renderers.Length == 0)
 16499            return;
 500
 5501        if (isNFT)
 1502            return;
 503
 4504        int totalMaterials = 0;
 16505        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 506        {
 4507            if (renderer == null)
 508                continue;
 4509            totalMaterials += renderer.sharedMaterials.Length;
 510        }
 511
 4512        if (!isNFT || (isNFT && originalMaterials == null))
 4513            originalMaterials = new Material[totalMaterials];
 514
 4515        int matCont = 0;
 16516        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 517        {
 4518            if (renderer == null)
 519                continue;
 520
 16521            for (int i = 0; i < renderer.sharedMaterials.Length; i++)
 522            {
 4523                if (isNFT && matCont == 0)
 524                {
 0525                    matCont++;
 0526                    continue;
 527                }
 528
 4529                originalMaterials[matCont] = renderer.sharedMaterials[i];
 4530                matCont++;
 531            }
 532        }
 4533    }
 534
 535    void SetEditMaterial()
 536    {
 18537        if (rootEntity.meshesInfo == null ||
 538            rootEntity.meshesInfo.renderers == null ||
 539            rootEntity.meshesInfo.renderers.Length < 1)
 18540            return;
 541
 0542        if (isNFT)
 0543            return;
 544
 0545        int matCont = 0;
 0546        foreach (Renderer renderer in rootEntity.meshesInfo.renderers)
 547        {
 0548            if (renderer == null)
 549                continue;
 550
 0551            Material[] materials = new Material[renderer.sharedMaterials.Length];
 552
 0553            for (int i = 0; i < renderer.sharedMaterials.Length; i++)
 554            {
 0555                if (isNFT && matCont == 0)
 556                {
 0557                    materials[i] = renderer.sharedMaterials[i];
 0558                    matCont++;
 0559                    continue;
 560                }
 561
 0562                materials[i] = editMaterial;
 0563                matCont++;
 564            }
 565
 0566            renderer.sharedMaterials = materials;
 567        }
 0568    }
 569
 16570    void OnNameUpdate(object model) { OnStatusUpdate?.Invoke(this); }
 571
 572    void OnShapeUpdate(IDCLEntity entity)
 573    {
 18574        ShapeInit();
 575
 18576        if (IsSelected)
 7577            SetEditMaterial();
 18578    }
 579
 580    void CreateCollidersForEntity(IDCLEntity entity)
 581    {
 21582        MeshesInfo meshInfo = entity.meshesInfo;
 21583        if (meshInfo == null ||
 584            meshInfo.currentShape == null ||
 585            !meshInfo.currentShape.IsVisible())
 15586            return;
 587
 6588        if (collidersGameObjectDictionary.ContainsKey(entity.scene.sceneData.id + entity.entityId) && !isNFT)
 0589            return;
 590
 6591        if (entity.children.Count > 0)
 592        {
 0593            using (var iterator = entity.children.GetEnumerator())
 594            {
 0595                while (iterator.MoveNext())
 596                {
 0597                    CreateCollidersForEntity(iterator.Current.Value);
 598                }
 0599            }
 600        }
 601
 602        //Note: When we are duplicating the GLTF and NFT component, their colliders are duplicated too
 603        //So we eliminate any previous collider to ensure that only 1 collider remain active
 6604        Transform[] children = GetComponentsInChildren<Transform>();
 66605        foreach (Transform child in children)
 606        {
 27607            if (child.gameObject.layer ==  BuilderInWorldSettings.COLLIDER_SELECTION_LAYER)
 608            {
 0609                Destroy(child.gameObject);
 610            }
 611        }
 612
 6613        List<GameObject> colliderList = new List<GameObject>();
 614
 24615        for (int i = 0; i < meshInfo.renderers.Length; i++)
 616        {
 6617            if (meshInfo.renderers[i] == null)
 618                continue;
 6619            GameObject entityColliderChildren = new GameObject(entity.entityId);
 6620            entityColliderChildren.layer = BuilderInWorldSettings.COLLIDER_SELECTION_LAYER;
 621
 6622            Transform t = entityColliderChildren.transform;
 6623            t.SetParent(meshInfo.renderers[i].transform);
 6624            t.ResetLocalTRS();
 625
 6626            var meshCollider = entityColliderChildren.AddComponent<MeshCollider>();
 627
 6628            if (meshInfo.renderers[i] is SkinnedMeshRenderer)
 629            {
 0630                Mesh meshColliderForSkinnedMesh = new Mesh();
 0631                (meshInfo.renderers[i] as SkinnedMeshRenderer).BakeMesh(meshColliderForSkinnedMesh);
 0632                meshCollider.sharedMesh = meshColliderForSkinnedMesh;
 0633                t.localScale = new Vector3(1 / meshInfo.renderers[i].gameObject.transform.lossyScale.x, 1 / meshInfo.ren
 0634            }
 635            else
 636            {
 6637                meshCollider.sharedMesh = meshInfo.renderers[i].GetComponent<MeshFilter>().sharedMesh;
 638            }
 639
 6640            meshCollider.enabled = meshInfo.renderers[i].enabled;
 6641            colliderList.Add(entityColliderChildren);
 642
 6643            if (isNFT)
 644            {
 2645                if (collidersGameObjectDictionary.ContainsKey(entity.scene.sceneData.id + entity.entityId))
 1646                    collidersGameObjectDictionary.Remove(entity.scene.sceneData.id + entity.entityId);
 647
 648
 2649                collidersGameObjectDictionary.Add(entity.scene.sceneData.id + entity.entityId, colliderList);
 650
 2651                colliderList = new List<GameObject>();
 652            }
 653        }
 654
 6655        if (!isNFT)
 5656            collidersGameObjectDictionary.Add(entity.scene.sceneData.id + entity.entityId, colliderList);
 6657    }
 658
 659    public bool IsEntityNFT()
 660    {
 106661        foreach (KeyValuePair<Type, ISharedComponent> keyValuePairBaseDisposable in rootEntity.sharedComponents)
 662        {
 32663            if (keyValuePairBaseDisposable.Value.GetClassId() == (int) CLASS_ID.NFT_SHAPE)
 2664                return true;
 665        }
 666
 20667        return false;
 2668    }
 669
 21670    bool IsEntityAFloor() { return GetCatalogItemAssociated()?.category == BuilderInWorldSettings.FLOOR_CATEGORY; }
 671
 672    bool IsEntityAVoxel()
 673    {
 21674        if (rootEntity.meshesInfo?.currentShape == null)
 15675            return false;
 6676        if (rootEntity.meshesInfo.renderers?.Length <= 0)
 1677            return false;
 5678        if (rootEntity.meshesInfo.mergedBounds.size != Vector3.one)
 5679            return false;
 0680        return true;
 681    }
 682}

Methods/Properties

IsLocked()
IsLocked(System.Boolean)
IsSelected()
IsSelected(System.Boolean)
IsNew()
IsNew(System.Boolean)
DCLBuilderInWorldEntity()
IsVisible()
IsVisible(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)
Init(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()