< Summary

Class:FireBasedAudioManager
Assembly:Test
File(s):E:/Unity/Unity Project/vr-firefighter-simulator/Assets/Test/FireBasedAudioManager.cs
Covered lines:18
Uncovered lines:0
Coverable lines:18
Total lines:40
Line coverage:100% (18 of 18)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:4
Method coverage:100% (4 of 4)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
FireBasedAudioManager()0%000100%
Awake()0%000100%
Update()0%000100%
NotifyFireChange(...)0%000100%

File(s)

E:/Unity/Unity Project/vr-firefighter-simulator/Assets/Test/FireBasedAudioManager.cs

#LineLine coverage
 1using UnityEngine;
 2
 3public class FireBasedAudioManager : MonoBehaviour, IFireDependant
 4{
 5    // Audio source to be played
 6    public AudioSource audioSource;
 7    // How many fires must be lit to play the audio
 8    public int fireLimit;
 9    // Time between the audio source is played
 10    public float timeInterval;
 11    // Indicates whether we are above the fire limit so the audio must be played
 12    private bool shouldPlay;
 13    // Last time audio was played
 814    private float lastPlayed = 0f;
 15
 16    // Start is called before the first frame update
 17    void Awake()
 418    {
 419       this.audioSource = this.GetComponent<AudioSource>();
 420       this.shouldPlay = true;
 421    }
 22
 23    // Update is called once per frame
 24    void Update()
 8850025    {
 17700026        if (this.shouldPlay) {
 8850027            if (this.lastPlayed >= this.timeInterval)
 22028            {
 22029                this.audioSource.Play();
 22030                this.lastPlayed = 0f;
 22031            }
 8850032            this.lastPlayed += Time.deltaTime;
 8850033        }
 8850034    }
 35
 36    public void NotifyFireChange(int fireCount)
 1637    {
 1638        this.shouldPlay = fireCount >= fireLimit;
 1639    }
 40}