< Summary

Class:AudioContainer
Assembly:Audio
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Audio/AudioContainer.cs
Covered lines:20
Uncovered lines:2
Coverable lines:22
Total lines:60
Line coverage:90.9% (20 of 22)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AudioContainer()0%110100%
Awake()0%660100%
GetEvent(...)0%3.213071.43%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Audio/AudioContainer.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.Audio;
 3using ReorderableList;
 4using System.Collections.Generic;
 5
 6public class AudioContainer : MonoBehaviour
 7{
 8    [System.Serializable]
 9    public class AudioEventList : ReorderableArray<AudioEvent> { }
 10
 11    public bool instantiateEvents = false;
 12    public AudioMixerGroup audioMixerGroup;
 13    [Range(0f, 1f)]
 215814    public float spatialBlend = 1f;
 15    public bool overrideDefaults = false;
 215816    public float dopplerLevel = 1f;
 215817    public float minDistance = 1;
 215818    public float maxDistance = 500;
 19
 20    [Reorderable]
 21    public AudioEventList audioEvents;
 22
 23    void Awake()
 24    {
 214525        if (!overrideDefaults)
 26        {
 86227            dopplerLevel = 0.0f;
 86228            minDistance = 1f;
 86229            maxDistance = 400f;
 30        }
 31
 214532        if (instantiateEvents)
 33        {
 2822634            for (int i = 0; i < audioEvents.Count; i++)
 35            {
 1283036                string str = audioEvents[i].name;
 1283037                AudioEvent instance = Instantiate(audioEvents[i]);
 1283038                audioEvents[i] = instance;
 1283039                instance.name = str;
 40            }
 41        }
 42
 3695843        foreach (AudioEvent e in audioEvents)
 44        {
 1633445            e.Initialize(this);
 46        }
 214547    }
 48
 49    public AudioEvent GetEvent(string eventName)
 50    {
 2989851        for (int i = 0; i < audioEvents.Count; i++)
 52        {
 1494953            if (audioEvents[i].name == eventName)
 299054                return audioEvents[i];
 55        }
 56
 057        Debug.Log($"{name}'s AudioContainer couldn't find an event called {eventName}");
 058        return null;
 59    }
 60}