< Summary

Class:SmoothAxisProvider
Assembly:Camera
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Camera/SmoothAxisProvider.cs
Covered lines:9
Uncovered lines:0
Coverable lines:9
Total lines:40
Line coverage:100% (9 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%330100%
Update()0%110100%
GetAxisValue(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Camera/SmoothAxisProvider.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using Cinemachine;
 5using Cinemachine.Utility;
 6using DCL.Camera;
 7using DCL.Helpers;
 8using UnityEngine;
 9
 10public class SmoothAxisProvider : MonoBehaviour, AxisState.IInputAxisProvider
 11{
 12    public Vector3 dampTime;
 13
 14    private Vector3 axis = new Vector3();
 15    private Vector3 axisTarget = new Vector3();
 16
 17    public InputAction_Measurable axisX;
 18    public InputAction_Measurable axisY;
 19    private InputSpikeFixer[] inputSpikeFixer;
 20
 21    private void Awake()
 22    {
 58923        inputSpikeFixer = new []
 24        {
 528625            new InputSpikeFixer(() => Utils.IsCursorLocked ? CursorLockMode.Locked : CursorLockMode.None),
 585126            new InputSpikeFixer(() => Utils.IsCursorLocked ? CursorLockMode.Locked : CursorLockMode.None)
 27        };
 58928    }
 29    void Update()
 30    {
 525331        axisTarget[0] = axisX.GetValue();
 525332        axisTarget[1] = axisY.GetValue();
 525333        axis += Damper.Damp(axisTarget - axis, dampTime, Time.deltaTime);
 525334    }
 35
 36    public float GetAxisValue(int axis)
 37    {
 995938        return inputSpikeFixer[axis].GetValue(this.axis[axis]);
 39    }
 40}