< Summary

Class:Hourglass
Assembly:Assembly-CSharp
File(s):D:/--UnityProject/VR/_____ISSTA 26/Edutainment-Escape-Room/Assets/Scripts/Test2/Hourglass.cs
Covered lines:14
Uncovered lines:8
Coverable lines:22
Total lines:47
Line coverage:63.6% (14 of 22)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:3
Method coverage:100% (3 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Hourglass()0%000100%
Start()0%000100%
Update()0%00052.94%

File(s)

D:/--UnityProject/VR/_____ISSTA 26/Edutainment-Escape-Room/Assets/Scripts/Test2/Hourglass.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4using UnityEngine.Serialization;
 5
 6public class Hourglass : MonoBehaviour
 7{
 8    [FormerlySerializedAs("hourglassTop")]
 9    public GameObject HourglassTop;
 10    [FormerlySerializedAs("hourglassBottom")]
 11    public GameObject HourglassBottom;
 12    [FormerlySerializedAs("timerFill")]
 613    public float TimerFill = 1.0f;
 14    [FormerlySerializedAs("particleSand")]
 15    public ParticleSystem ParticleSand;
 16
 17    Material m_TopMat;
 18    Material m_BotMat;
 19
 20    // Start is called before the first frame update
 21    void Start()
 322    {
 323        m_TopMat = HourglassTop.GetComponent<MeshRenderer>().material;
 324        m_BotMat = HourglassBottom.GetComponent<MeshRenderer>().material;
 325    }
 26
 27    // Update is called once per frame
 28    void Update()
 70529    {
 70530        if (Vector3.Dot(transform.up, Vector3.down) > 0.8 && TimerFill > 0)
 031        {
 032            TimerFill -= 0.1f * Time.deltaTime;
 033            ParticleSand.Play();
 034        }
 70535        else if (Vector3.Dot(transform.up, Vector3.down) < -0.8 && TimerFill < 1)
 036        {
 037            TimerFill += 0.1f * Time.deltaTime;
 038            ParticleSand.Play();
 039        } else
 70540        {
 70541            ParticleSand.Stop();
 70542        }
 43
 70544        m_TopMat.SetFloat("TimerFill", TimerFill);
 70545        m_BotMat.SetFloat("TimerFill", TimerFill);
 70546    }
 47}

Methods/Properties

Hourglass()
Start()
Update()