< Summary

Class:FireBasedAudioManager
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/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)

D:/--UnityProject/VR/_____ISSTA 26/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()
 4643625    {
 9287226        if (this.shouldPlay) {
 4643627            if (this.lastPlayed >= this.timeInterval)
 14428            {
 14429                this.audioSource.Play();
 14430                this.lastPlayed = 0f;
 14431            }
 4643632            this.lastPlayed += Time.deltaTime;
 4643633        }
 4643634    }
 35
 36    public void NotifyFireChange(int fireCount)
 2037    {
 2038        this.shouldPlay = fireCount >= fireLimit;
 2039    }
 40}