< Summary

Class:UserPositionHandler
Assembly:GlobalUsersPositionMarker
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/MapRenderer/GlobalUsersPositionMarker/Handlers/UserPositionHandler.cs
Covered lines:8
Uncovered lines:1
Coverable lines:9
Total lines:25
Line coverage:88.8% (8 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
UserPositionHandler()0%110100%
Dispose()0%110100%
OnPlayerCoords(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/MapRenderer/GlobalUsersPositionMarker/Handlers/UserPositionHandler.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3
 4/// <summary>
 5/// Handle user position changes to let other handler or controller to react appropriately
 6/// </summary>
 7internal class UserPositionHandler : IDisposable
 8{
 09    public Vector2Int playerCoords { private set; get; }
 10    public event Action<Vector2Int> OnPlayerCoordsChanged;
 11
 11212    public UserPositionHandler()
 13    {
 11214        playerCoords = CommonScriptableObjects.playerCoords.Get();
 11215        CommonScriptableObjects.playerCoords.OnChange += OnPlayerCoords;
 11216    }
 17
 147618    public void Dispose() { CommonScriptableObjects.playerCoords.OnChange -= OnPlayerCoords; }
 19
 20    private void OnPlayerCoords(Vector2Int current, Vector2Int prev)
 21    {
 12222        playerCoords = current;
 12223        OnPlayerCoordsChanged?.Invoke(playerCoords);
 11924    }
 25}