< Summary

Class:GeneralHUDElementAudioHandler
Assembly:HUDCommon
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Common/Audio/HUDElements/GeneralHUDElementAudioHandler.cs
Covered lines:1
Uncovered lines:13
Coverable lines:14
Total lines:35
Line coverage:7.1% (1 of 14)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GeneralHUDElementAudioHandler()0%110100%
OnPointerEnter(...)0%12300%
OnPointerDown(...)0%6200%
OnPointerUp(...)0%6200%

File(s)

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

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.EventSystems;
 3
 4public class GeneralHUDElementAudioHandler : MonoBehaviour, IPointerEnterHandler, IPointerDownHandler, IPointerUpHandler
 5{
 6    [SerializeField]
 601417    protected bool playHover = true, playClick = true, playRelease = true;
 8
 9    public virtual void OnPointerEnter(PointerEventData eventData)
 10    {
 011        if (!playHover)
 012            return;
 13
 014        if (!Input.GetMouseButton(0))
 15        {
 016            AudioScriptableObjects.buttonHover.Play(true);
 17        }
 018    }
 19
 20    public virtual void OnPointerDown(PointerEventData eventData)
 21    {
 022        if (!playClick)
 023            return;
 24
 025        AudioScriptableObjects.buttonClick.Play(true);
 026    }
 27
 28    public virtual void OnPointerUp(PointerEventData eventData)
 29    {
 030        if (!playRelease)
 031            return;
 32
 033        AudioScriptableObjects.buttonRelease.Play(true);
 034    }
 35}