< Summary

Class:InfiniteFloorController
Assembly:InfiniteFloor
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/InfiniteFloor/InfiniteFloorController.cs
Covered lines:20
Uncovered lines:0
Coverable lines:20
Total lines:41
Line coverage:100% (20 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
InfiniteFloorController()0%110100%
OnEnable()0%110100%
OnPlayerCoordsChanged(...)0%110100%
OnMapTextureChanged(...)0%110100%
OnEstateIdTextureChanged(...)0%110100%
OnWorldReposition(...)0%110100%
OnDisable()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/InfiniteFloor/InfiniteFloorController.cs

#LineLine coverage
 1using DCL;
 2using UnityEngine;
 3
 4public class InfiniteFloorController : MonoBehaviour
 5{
 16    private static readonly int MAP_PROPERTY = Shader.PropertyToID("_Map");
 17    private static readonly int ESTATE_ID_PROPERTY = Shader.PropertyToID("_EstateIDMap");
 18    private static readonly int PLAYER_POSITION = Shader.PropertyToID("_PlayerPosition");
 9
 10    [SerializeField] private Renderer renderer;
 11
 12    void OnEnable()
 13    {
 8814        CommonScriptableObjects.worldOffset.OnChange += OnWorldReposition;
 15
 8816        DataStore.i.HUDs.mapMainTexture.OnChange += OnMapTextureChanged;
 8817        OnMapTextureChanged(DataStore.i.HUDs.mapMainTexture.Get(), null);
 18
 8819        DataStore.i.HUDs.mapEstatesTexture.OnChange += OnEstateIdTextureChanged;
 8820        OnEstateIdTextureChanged(DataStore.i.HUDs.mapEstatesTexture.Get(), null);
 21
 8822        CommonScriptableObjects.playerCoords.OnChange += OnPlayerCoordsChanged;
 8823        OnPlayerCoordsChanged(CommonScriptableObjects.playerCoords.Get(), Vector2Int.zero);
 8824    }
 25
 19226    private void OnPlayerCoordsChanged(Vector2Int current, Vector2Int previous) { renderer.material.SetVector(PLAYER_POS
 27
 17628    private void OnMapTextureChanged(Texture current, Texture previous) { renderer.material.SetTexture(MAP_PROPERTY, cur
 29
 17630    private void OnEstateIdTextureChanged(Texture current, Texture previous) { renderer.material.SetTexture(ESTATE_ID_PR
 31
 432    void OnWorldReposition(UnityEngine.Vector3 current, UnityEngine.Vector3 previous) { transform.position = -current; }
 33
 34    void OnDisable()
 35    {
 8836        CommonScriptableObjects.worldOffset.OnChange -= OnWorldReposition;
 8837        DataStore.i.HUDs.mapMainTexture.OnChange -= OnMapTextureChanged;
 8838        DataStore.i.HUDs.mapEstatesTexture.OnChange -= OnEstateIdTextureChanged;
 8839        CommonScriptableObjects.playerCoords.OnChange -= OnPlayerCoordsChanged;
 8840    }
 41}