< Summary

Class:DCLPlugins.ECSComponents.Raycast.RaycastComponentHandler
Assembly:DCLPlugins.ECSComponents.Raycast.Handler
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Raycast/Handler/RaycastHandler.cs
Covered lines:10
Uncovered lines:2
Coverable lines:12
Total lines:43
Line coverage:83.3% (10 of 12)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:4
Method coverage:75% (3 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
RaycastComponentHandler(...)0%110100%
OnComponentCreated(...)0%110100%
OnComponentRemoved(...)0%2100%
OnComponentModelUpdated(...)0%550100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Raycast/Handler/RaycastHandler.cs

#LineLine coverage
 1using DCL.Controllers;
 2using DCL.ECS7.InternalComponents;
 3using DCL.ECSComponents;
 4using DCL.ECSRuntime;
 5using DCL.Models;
 6
 7namespace DCLPlugins.ECSComponents.Raycast
 8{
 9    public class RaycastComponentHandler : IECSComponentHandler<PBRaycast>
 10    {
 11        private IInternalECSComponent<InternalRaycast> internalRaycastComponent;
 12        private InternalRaycast internalRaycastModel = new InternalRaycast();
 13        private PBRaycast previousModel;
 14
 2815        public RaycastComponentHandler(IInternalECSComponent<InternalRaycast> internalRaycastComponent)
 16        {
 2817            this.internalRaycastComponent = internalRaycastComponent;
 2818        }
 19
 20        public void OnComponentCreated(IParcelScene scene, IDCLEntity entity)
 21        {
 2822        }
 23
 24        public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity)
 25        {
 026            internalRaycastComponent.RemoveFor(scene, entity);
 027        }
 28
 29        public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, PBRaycast model)
 30        {
 3231            if (!model.Continuous && previousModel != null && !previousModel.Continuous
 32                && previousModel.Timestamp == model.Timestamp)
 133                return;
 34
 3135            internalRaycastModel.raycastModel = model;
 36
 37            // Ray casting is done in ECSRaycastSystem for all entities with the InternalRaycast component
 3138            internalRaycastComponent.PutFor(scene, entity, internalRaycastModel);
 39
 3140            previousModel = model;
 3141        }
 42    }
 43}