< Summary

Class:DCL.ECSComponents.ProtoConvertUtils
Assembly:ECSComponents.Utils
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Utils/ProtoConvertUtils.cs
Covered lines:6
Uncovered lines:29
Coverable lines:35
Total lines:76
Line coverage:17.1% (6 of 35)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetPointerUpResultModel(...)0%6200%
GetPointerDownResultModel(...)0%6200%
UnityVectorToPBVector(...)0%2100%
PBVectorToUnityVector(...)0%110100%
PBCameraEnumToUnityEnum(...)0%5.673033.33%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using DCL.Helpers;
 5using UnityEngine;
 6
 7namespace DCL.ECSComponents
 8{
 9    public static class ProtoConvertUtils
 10    {
 11        public static PBOnPointerUpResult GetPointerUpResultModel(ActionButton buttonId, string meshName, Ray ray, HitIn
 12        {
 013            PBOnPointerUpResult result = new PBOnPointerUpResult();
 014            result.Button = buttonId;
 015            result.Direction = UnityVectorToPBVector(ray.direction);
 016            result.Distance = hit.distance;
 017            result.Normal = UnityVectorToPBVector(hit.normal);
 018            result.Origin = UnityVectorToPBVector(ray.origin);
 019            result.Point = UnityVectorToPBVector(hit.point);
 20
 21            // This null check will disappear when we introduce optionals to the proto
 022            if(meshName == null)
 023                meshName = String.Empty;
 024            result.MeshName = meshName;
 025            return result;
 26        }
 27
 28        public static PBOnPointerDownResult GetPointerDownResultModel(ActionButton buttonId, string meshName, Ray ray, H
 29        {
 030            PBOnPointerDownResult result = new PBOnPointerDownResult();
 031            result.Button = buttonId;
 032            result.Direction = UnityVectorToPBVector(ray.direction);
 033            result.Distance = hit.distance;
 034            result.Normal = UnityVectorToPBVector(hit.normal);
 035            result.Origin = UnityVectorToPBVector(ray.origin);
 036            result.Point = UnityVectorToPBVector(hit.point);
 37
 38            // This null check will disappear when we introduce optionals to the proto
 039            if(meshName == null)
 040                meshName = String.Empty;
 041            result.MeshName = meshName;
 042            return result;
 43        }
 44
 45        public static Vector3 UnityVectorToPBVector(UnityEngine.Vector3 original)
 46        {
 047            Vector3 vector = new Vector3();
 048            vector.X = original.x;
 049            vector.Y = original.y;
 050            vector.Z = original.z;
 051            return vector;
 52        }
 53
 54        public static UnityEngine.Vector3 PBVectorToUnityVector(Vector3 original)
 55        {
 656            UnityEngine.Vector3 vector = new UnityEngine.Vector3();
 657            vector.x = original.X;
 658            vector.y = original.Y;
 659            vector.z = original.Z;
 660            return vector;
 61        }
 62
 63        public static CameraTool.CameraMode.ModeId PBCameraEnumToUnityEnum(CameraMode mode)
 64        {
 65            switch (mode)
 66            {
 67                case CameraMode.FirstPerson:
 468                    return CameraTool.CameraMode.ModeId.FirstPerson;
 69                case CameraMode.ThirdPerson:
 070                    return CameraTool.CameraMode.ModeId.ThirdPerson;
 71                default:
 072                    return CommonScriptableObjects.cameraMode.Get();
 73            }
 74        }
 75    }
 76}