< Summary

Class:ECSSystems.PointerInputSystem.PointerInputHelper
Assembly:ECS7Plugin.Systems.PointerInput
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/Systems/PointerInputSystem/PointerInputHelper.cs
Covered lines:5
Uncovered lines:5
Coverable lines:10
Total lines:47
Line coverage:50% (5 of 10)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
IsInputForEntity(...)0%2100%
IsValidFistanceForEntity(...)0%2100%
IsValidInputForEntity(...)0%440100%
GetName(...)0%12300%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/Systems/PointerInputSystem/PointerInputHelper.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using UnityEngine;
 3
 4namespace ECSSystems.PointerInputSystem
 5{
 6    internal static class PointerInputHelper
 7    {
 8        public static bool IsInputForEntity(Collider pointerEventCollider, IList<Collider> colliders)
 9        {
 010            return colliders.Contains(pointerEventCollider);
 11        }
 12
 13        public static bool IsValidFistanceForEntity(float pointerEventDistance, float maxDistance)
 14        {
 015            return pointerEventDistance <= maxDistance;
 16        }
 17
 18        public static bool IsValidInputForEntity(int pointerEventButton, float pointerEventDistance, float maxDistance, 
 19        {
 1020            if (!IsValidFistanceForEntity(pointerEventDistance, maxDistance))
 221                return false;
 22
 823            if (button == ActionButton.Any || (int)button == pointerEventButton)
 24            {
 725                return true;
 26            }
 127            return false;
 28        }
 29
 30        public static string GetName(this ActionButton button)
 31        {
 32            const string ACTION_BUTTON_POINTER = "POINTER";
 33            const string ACTION_BUTTON_PRIMARY = "PRIMARY";
 34            const string ACTION_BUTTON_SECONDARY = "SECONDARY";
 35
 36            switch (button)
 37            {
 38                case ActionButton.Primary:
 039                    return ACTION_BUTTON_PRIMARY;
 40                case ActionButton.Secondary:
 041                    return ACTION_BUTTON_SECONDARY;
 42                default:
 043                    return ACTION_BUTTON_POINTER;
 44            }
 45        }
 46    }
 47}