< Summary

Class:SpawnPointsDisplayerPlugin
Assembly:DebugPlugins.SpawnpointsDisplayerPlugin
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/SpawnPointsDisplayerPlugin/SpawnPointsDisplayerPlugin.cs
Covered lines:17
Uncovered lines:2
Coverable lines:19
Total lines:46
Line coverage:89.4% (17 of 19)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SpawnPointsDisplayerPlugin()0%2100%
SpawnPointsDisplayerPlugin(...)0%110100%
Dispose()0%220100%
OnSpawnPointAdded(...)0%330100%
OnSpawnPointRemoved(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/SpawnPointsDisplayerPlugin/SpawnPointsDisplayerPlugin.cs

#LineLine coverage
 1using DCL;
 2using Variables.SpawnPoints;
 3
 4public class SpawnPointsDisplayerPlugin : IPlugin
 5{
 6    private readonly BaseDictionary<string, SceneSpawnPointsData> spawnPointsVariable;
 7    private ISpawnPointsDataHandler spawnPointsDataHandler;
 8
 09    public SpawnPointsDisplayerPlugin() : this(
 10        DataStore.i.debugConfig.showSceneSpawnPoints,
 011        new SpawnPointsDataHandler(new SpawnPointIndicatorInstantiator())) { }
 12
 413    internal SpawnPointsDisplayerPlugin(
 14        in BaseDictionary<string, SceneSpawnPointsData> spawnPointsVariable,
 15        in ISpawnPointsDataHandler spawnPointsDataHandler)
 16    {
 417        this.spawnPointsVariable = spawnPointsVariable;
 418        this.spawnPointsDataHandler = spawnPointsDataHandler;
 19
 420        spawnPointsVariable.OnAdded += OnSpawnPointAdded;
 421        spawnPointsVariable.OnRemoved += OnSpawnPointRemoved;
 422    }
 23
 24    public void Dispose()
 25    {
 526        spawnPointsVariable.OnAdded -= OnSpawnPointAdded;
 527        spawnPointsVariable.OnRemoved -= OnSpawnPointRemoved;
 28
 529        spawnPointsDataHandler?.Dispose();
 530        spawnPointsDataHandler = null;
 531    }
 32
 33    private void OnSpawnPointAdded(string sceneId, SceneSpawnPointsData spawnPointsInfo)
 34    {
 335        spawnPointsDataHandler.RemoveSpawnPoints(sceneId);
 336        if (spawnPointsInfo.enabled.HasValue && spawnPointsInfo.enabled.Value)
 37        {
 238            spawnPointsDataHandler.CreateSpawnPoints(sceneId, spawnPointsInfo.spawnPoints);
 39        }
 340    }
 41
 42    private void OnSpawnPointRemoved(string sceneId, SceneSpawnPointsData spawnPointsInfo)
 43    {
 144        spawnPointsDataHandler.RemoveSpawnPoints(sceneId);
 145    }
 46}