< 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:7
Uncovered lines:2
Coverable lines:9
Total lines:25
Line coverage:77.7% (7 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%2.152066.67%

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
 1112    public UserPositionHandler()
 13    {
 1114        playerCoords = CommonScriptableObjects.playerCoords.Get();
 1115        CommonScriptableObjects.playerCoords.OnChange += OnPlayerCoords;
 1116    }
 17
 2618    public void Dispose() { CommonScriptableObjects.playerCoords.OnChange -= OnPlayerCoords; }
 19
 20    private void OnPlayerCoords(Vector2Int current, Vector2Int prev)
 21    {
 222        playerCoords = current;
 223        OnPlayerCoordsChanged?.Invoke(playerCoords);
 024    }
 25}