< Summary

Class:LoopManager
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_subjects/Edutainment-Escape-Room/Assets/Scripts/Test/LoopTask/LoopManager.cs
Covered lines:34
Uncovered lines:23
Coverable lines:57
Total lines:89
Line coverage:59.6% (34 of 57)
Covered branches:0
Total branches:0
Covered methods:10
Total methods:10
Method coverage:100% (10 of 10)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
LoopManager()0%000100%
Start()0%000100%
Update()0%00025%
outsideWhile()0%000100%
outsideIf()0%000100%
outsideRemoved()0%000100%
insideKey()0%000100%
insideLight()0%000100%
insideRemoved()0%000100%
ButtonPressed()0%00025%

File(s)

D:/--UnityProject/VR/VRExplorer_subjects/Edutainment-Escape-Room/Assets/Scripts/Test/LoopTask/LoopManager.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using UnityEngine;
 5using UnityEngine.Events;
 6
 7public class LoopManager : MonoBehaviour
 8{
 9    public GameObject key;
 10    public GameObject spotlight;
 11
 212    [SerializeField] private int outsideState = 0; //used to keep track of which piece is put in the outside socket
 213    [SerializeField] private int insideState = 0; //used to keep track of which piece is put in the inside socket
 14
 215    private bool showShort = false;
 216    private float ifTimer = 0;
 17
 18    private void Start()
 119    {
 120        key.SetActive(false);
 121        spotlight.SetActive(false);
 122    }
 23
 24    private void Update()
 273525    {
 273526        if (showShort)
 027        {
 028            ifTimer -= Time.deltaTime;
 029            if(ifTimer < 0)
 030            {
 031                showShort = false;
 32                //turn off key and light
 033                key.SetActive(false);
 034                spotlight.SetActive(false);
 035            }
 036        }
 273537    }
 38
 39    internal void outsideWhile()
 140    {
 141        outsideState = 1; //state 1 means function will run constantly, eg. key will show permanently
 142    }
 43
 44    internal void outsideIf()
 145    {
 146        outsideState = 2; //state 2 means function will run 1 time, eg. key will show for short burst of time
 147    }
 48
 49    internal void outsideRemoved()
 150    {
 151        outsideState = 0; //state 0 means running function will do nothing
 152    }
 53    internal void insideKey()
 154    {
 155        insideState = 1; //state 1 means the key will show depending on outside state
 156    }
 57
 58    internal void insideLight()
 159    {
 160        insideState = 2; //state 2 means light will be turned on depending on outside state
 161    }
 62
 63    internal void insideRemoved()
 164    {
 165        insideState = 0; //state 0 does nothing
 166    }
 67
 68    public void ButtonPressed()
 169    {
 170        key.SetActive(false);
 171        spotlight.SetActive(false);
 172        if(outsideState != 0)
 073        {
 074            if (insideState == 1)
 075            {
 076                key.SetActive(true);
 077            } else if (insideState == 2)
 078            {
 079                spotlight.SetActive(true);
 080            }
 81
 082            if (outsideState == 2)
 083            {
 084                showShort = true;
 085                ifTimer = 1;
 086            }
 087        }
 188    }
 89}