< Summary

Class:SliderAudioHandler
Assembly:HUDCommon
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Common/Audio/HUDElements/SliderAudioHandler.cs
Covered lines:6
Uncovered lines:8
Coverable lines:14
Total lines:42
Line coverage:42.8% (6 of 14)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
OnPointerDown(...)0%12300%
OnPointerUp(...)0%12300%
OnValueChanged(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Common/Audio/HUDElements/SliderAudioHandler.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.EventSystems;
 3using UnityEngine.UI;
 4
 5public class SliderAudioHandler : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
 6{
 7    Slider slider;
 8
 9    void Awake()
 10    {
 1811        slider = GetComponent<Slider>();
 1812        slider.onValueChanged.AddListener(OnValueChanged);
 1813    }
 14
 15    public void OnPointerDown(PointerEventData eventData)
 16    {
 017        if (slider != null)
 18        {
 019            if (slider.interactable)
 20            {
 021                AudioScriptableObjects.buttonClick.Play(true);
 22            }
 23        }
 024    }
 25
 26    public void OnPointerUp(PointerEventData eventData)
 27    {
 028        if (slider != null)
 29        {
 030            if (slider.interactable)
 31            {
 032                AudioScriptableObjects.buttonRelease.Play(true);
 33            }
 34        }
 035    }
 36
 37    void OnValueChanged(float value)
 38    {
 2039        AudioScriptableObjects.sliderValueChange.SetPitch(1f + ((slider.value - slider.minValue) / (slider.maxValue - sl
 2040        AudioScriptableObjects.sliderValueChange.Play(true);
 2041    }
 42}