< Summary

Class:SpawnPointIndicator
Assembly:DebugPlugins.SpawnpointsDisplayerPlugin
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/SpawnPointsDisplayerPlugin/SpawnPointIndicator.cs
Covered lines:15
Uncovered lines:4
Coverable lines:19
Total lines:59
Line coverage:78.9% (15 of 19)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SpawnPointIndicator(...)0%110100%
Dispose()0%220100%
SetName(...)0%2100%
SetPosition(...)0%110100%
SetSize(...)0%110100%
SetRotation(...)0%110100%
OnWorldReposition(...)0%2100%

File(s)

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

#LineLine coverage
 1using System;
 2using DCL.Helpers;
 3using UnityEngine;
 4using Object = UnityEngine.Object;
 5
 6internal interface ISpawnPointIndicator : IDisposable
 7{
 8    void SetName(in string name);
 9    void SetPosition(in Vector3 position);
 10    void SetSize(in Vector3 size);
 11    void SetRotation(in Quaternion? rotation);
 12}
 13
 14internal class SpawnPointIndicator : ISpawnPointIndicator
 15{
 16    private SpawnPointIndicatorMonoBehaviour spawnPointIndicatorBehaviour;
 17    private Vector3 position;
 18
 419    public SpawnPointIndicator(SpawnPointIndicatorMonoBehaviour spawnPointIndicatorBehaviour)
 20    {
 421        this.spawnPointIndicatorBehaviour = spawnPointIndicatorBehaviour;
 422        CommonScriptableObjects.worldOffset.OnChange += OnWorldReposition;
 423    }
 24
 25    void IDisposable.Dispose()
 26    {
 127        CommonScriptableObjects.worldOffset.OnChange -= OnWorldReposition;
 128        if (!spawnPointIndicatorBehaviour.isDestroyed)
 29        {
 130            Object.Destroy(spawnPointIndicatorBehaviour.gameObject);
 31        }
 132    }
 33
 34    void ISpawnPointIndicator.SetName(in string name)
 35    {
 036        spawnPointIndicatorBehaviour.SetName(name);
 037    }
 38
 39    void ISpawnPointIndicator.SetPosition(in Vector3 position)
 40    {
 141        this.position = position;
 142        spawnPointIndicatorBehaviour.SetPosition(PositionUtils.WorldToUnityPosition(position));
 143    }
 44
 45    void ISpawnPointIndicator.SetSize(in Vector3 size)
 46    {
 147        spawnPointIndicatorBehaviour.SetSize(size);
 148    }
 49
 50    void ISpawnPointIndicator.SetRotation(in Quaternion? rotation)
 51    {
 252        spawnPointIndicatorBehaviour.SetRotation(rotation);
 253    }
 54
 55    void OnWorldReposition(Vector3 current, Vector3 previous)
 56    {
 057        spawnPointIndicatorBehaviour.SetPosition(PositionUtils.WorldToUnityPosition(position));
 058    }
 59}