< 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    {
 8714        CommonScriptableObjects.worldOffset.OnChange += OnWorldReposition;
 15
 8716        DataStore.i.HUDs.mapMainTexture.OnChange += OnMapTextureChanged;
 8717        OnMapTextureChanged(DataStore.i.HUDs.mapMainTexture.Get(), null);
 18
 8719        DataStore.i.HUDs.mapEstatesTexture.OnChange += OnEstateIdTextureChanged;
 8720        OnEstateIdTextureChanged(DataStore.i.HUDs.mapEstatesTexture.Get(), null);
 21
 8722        CommonScriptableObjects.playerCoords.OnChange += OnPlayerCoordsChanged;
 8723        OnPlayerCoordsChanged(CommonScriptableObjects.playerCoords.Get(), Vector2Int.zero);
 8724    }
 25
 19026    private void OnPlayerCoordsChanged(Vector2Int current, Vector2Int previous) { renderer.material.SetVector(PLAYER_POS
 27
 17428    private void OnMapTextureChanged(Texture current, Texture previous) { renderer.material.SetTexture(MAP_PROPERTY, cur
 29
 17430    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    {
 8736        CommonScriptableObjects.worldOffset.OnChange -= OnWorldReposition;
 8737        DataStore.i.HUDs.mapMainTexture.OnChange -= OnMapTextureChanged;
 8738        DataStore.i.HUDs.mapEstatesTexture.OnChange -= OnEstateIdTextureChanged;
 8739        CommonScriptableObjects.playerCoords.OnChange -= OnPlayerCoordsChanged;
 8740    }
 41}