< Summary

Class:DCL.ECSComponents.Utils.ECSAvatarUtils
Assembly:ECSComponents.Utils
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Utils/ECSAvatarUtils.cs
Covered lines:12
Uncovered lines:0
Coverable lines:12
Total lines:35
Line coverage:100% (12 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
ECSAvatarUtils()0%110100%
DetectAvatars(...)0%550100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Utils/ECSAvatarUtils.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using UnityEngine;
 3
 4namespace DCL.ECSComponents.Utils
 5{
 6    public static class ECSAvatarUtils
 7    {
 8        private const string AVATAR_TRIGGER_LAYER = "AvatarTriggerDetection";
 9        private const int MAX_AVATARS = 100;
 10
 111        private static int mask = LayerMask.GetMask(AVATAR_TRIGGER_LAYER);
 112        private static Collider[] resultColliders = new Collider[MAX_AVATARS]; // max 100 avatars
 13
 14        public static HashSet<GameObject> DetectAvatars(in Vector3 box, in Vector3 center, in Quaternion rotation, in Ha
 15        {
 816            HashSet<GameObject> result = new HashSet<GameObject>();
 17
 818            int collidersFoundAmount = Physics.OverlapBoxNonAlloc(center, box * 0.5f, resultColliders, rotation, mask, Q
 819            if (collidersFoundAmount == 0)
 320                return result;
 21
 522            bool hasExcludeList = excludeColliders != null;
 23
 2224            for (var i = 0; i < collidersFoundAmount; i++)
 25            {
 626                var collider = resultColliders[i];
 627                if (hasExcludeList && excludeColliders.Contains(collider))
 28                    continue;
 29
 530                result.Add(collider.transform.parent.gameObject);
 31            }
 532            return result;
 33        }
 34    }
 35}