< Summary

Class:InternalMaterialHandler
Assembly:ECS7Plugin.InternalECSComponents
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Handlers/InternalMaterialHandler.cs
Covered lines:10
Uncovered lines:1
Coverable lines:11
Total lines:35
Line coverage:90.9% (10 of 11)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnComponentCreated(...)0%110100%
OnComponentRemoved(...)0%4.024088.89%
OnComponentModelUpdated(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Handlers/InternalMaterialHandler.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using DCL.Controllers;
 3using DCL.ECS7.InternalComponents;
 4using DCL.ECSRuntime;
 5using DCL.Models;
 6using UnityEngine;
 7
 8public class InternalMaterialHandler : IECSComponentHandler<InternalMaterial>
 9{
 10    internal IList<Renderer> renderers;
 11
 512    public void OnComponentCreated(IParcelScene scene, IDCLEntity entity) { }
 13
 14    public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity)
 15    {
 316        if (renderers == null)
 017            return;
 18
 1619        for (int i = 0; i < renderers.Count; i++)
 20        {
 521            Renderer r = renderers[i];
 522            if (r is null)
 23                continue;
 324            r.sharedMaterial = null;
 25        }
 326    }
 27
 28    public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, InternalMaterial model)
 29    {
 1530        if (model.renderers != null)
 31        {
 832            renderers = model.renderers;
 33        }
 1534    }
 35}