< Summary

Class:ECSTransformParentingSystem
Assembly:DCL.ECSComponents.Transform.System
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Transform/System/ECSTransformParentingSystem.cs
Covered lines:11
Uncovered lines:1
Coverable lines:12
Total lines:36
Line coverage:91.6% (11 of 12)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:2
Method coverage:100% (2 of 2)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateSystem(...)0%110100%
Update(...)0%6.026092.31%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Transform/System/ECSTransformParentingSystem.cs

#LineLine coverage
 1using DCL.ECS7.InternalComponents;
 2using DCL.Models;
 3using System;
 4
 5public static class ECSTransformParentingSystem
 6{
 7    public static Action CreateSystem(IInternalECSComponent<InternalSceneBoundsCheck> internalSceneBoundsCheckComponent)
 8    {
 119        return () => Update(internalSceneBoundsCheckComponent);
 10    }
 11
 12    private static void Update(IInternalECSComponent<InternalSceneBoundsCheck> sbcInternalComponent)
 13    {
 614        if (ECSTransformUtils.orphanEntities == null || ECSTransformUtils.orphanEntities.Count == 0)
 15        {
 016            return;
 17        }
 18
 619        int count = ECSTransformUtils.orphanEntities.Count;
 20
 2421        for (int i = count - 1; i >= 0; i--)
 22        {
 623            var data = ECSTransformUtils.orphanEntities.Pairs[i].value;
 24
 625            if (ECSTransformUtils.TrySetParent(data.scene, data.entity, data.parentId, out IDCLEntity parent))
 26            {
 527                if (data.entity.parentId != SpecialEntityId.SCENE_ROOT_ENTITY)
 328                    parent.childrenId.Add(data.entity.entityId);
 29
 530                ECSTransformUtils.orphanEntities.RemoveAt(i);
 31
 532                sbcInternalComponent.SetPosition(data.scene, data.entity, data.entity.gameObject.transform.position);
 33            }
 34        }
 635    }
 36}