< Summary

Class:AvatarSystem.BaseAvatarReferences
Assembly:AvatarSystem
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/AvatarSystem/BaseAvatarReferences.cs
Covered lines:5
Uncovered lines:12
Coverable lines:17
Total lines:58
Line coverage:29.4% (5 of 17)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:11
Method coverage:36.3% (4 of 11)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BaseAvatarReferences()0%110100%
CacheAnchors()0%6200%
Dispose()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/AvatarSystem/BaseAvatarReferences.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3
 4namespace AvatarSystem
 5{
 6    [Serializable]
 7    public struct AvatarAnchorPoint
 8    {
 9        public string AnchorName;
 10        public Transform Bone;
 11    }
 12
 13    [Serializable]
 14    public class BaseAvatarReferences : MonoBehaviour, IBaseAvatarReferences
 15    {
 16        [Header("References")]
 17        public SkinnedMeshRenderer skinnedMeshRenderer;
 18        public Transform armatureContainer;
 19        public GameObject particlesContainer;
 20        public AvatarAnchorPoint[] anchors;
 21
 22        [Header("Ghost Settings")]
 23        [ColorUsage(true, true)] public Color ghostMinColor;
 24        [ColorUsage(true, true)] public Color ghostMaxColor;
 325        public float fadeGhostSpeed = 2f;
 326        public float revealSpeed = 2f;
 27
 428        public SkinnedMeshRenderer SkinnedMeshRenderer => skinnedMeshRenderer;
 29
 30        private (string AnchorName, Transform Bone)[] anchorsCache;
 031        public (string AnchorName, Transform Bone)[] Anchors => anchorsCache ??= CacheAnchors();
 32
 033        public Transform ArmatureContainer => armatureContainer;
 034        public GameObject ParticlesContainer => particlesContainer;
 235        public Color GhostMinColor => ghostMinColor;
 236        public Color GhostMaxColor => ghostMaxColor;
 037        public float FadeGhostSpeed => fadeGhostSpeed;
 038        public float RevealSpeed => revealSpeed;
 39
 40        private (string AnchorName, Transform Bone)[] CacheAnchors()
 41        {
 042            var cachedAnchors = new (string, Transform)[anchors.Length];
 43
 044            for (var i = 0; i < anchors.Length; i++)
 45            {
 046                AvatarAnchorPoint anchorPoint = anchors[i];
 047                cachedAnchors[i] = (anchorPoint.AnchorName, anchorPoint.Bone);
 48            }
 49
 050            return cachedAnchors;
 51        }
 52
 53        public void Dispose()
 54        {
 055            Destroy(gameObject);
 056        }
 57    }
 58}