< Summary

Class:LoopManager
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_subjects/Edutainment-Escape-Room/Assets/Scripts/Test/LoopTask/LoopManager.cs
Covered lines:11
Uncovered lines:46
Coverable lines:57
Total lines:89
Line coverage:19.2% (11 of 57)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:10
Method coverage:30% (3 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%0000%
outsideIf()0%0000%
outsideRemoved()0%0000%
insideKey()0%0000%
insideLight()0%0000%
insideRemoved()0%0000%
ButtonPressed()0%0000%

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()
 129725    {
 129726        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        }
 129737    }
 38
 39    internal void outsideWhile()
 040    {
 041        outsideState = 1; //state 1 means function will run constantly, eg. key will show permanently
 042    }
 43
 44    internal void outsideIf()
 045    {
 046        outsideState = 2; //state 2 means function will run 1 time, eg. key will show for short burst of time
 047    }
 48
 49    internal void outsideRemoved()
 050    {
 051        outsideState = 0; //state 0 means running function will do nothing
 052    }
 53    internal void insideKey()
 054    {
 055        insideState = 1; //state 1 means the key will show depending on outside state
 056    }
 57
 58    internal void insideLight()
 059    {
 060        insideState = 2; //state 2 means light will be turned on depending on outside state
 061    }
 62
 63    internal void insideRemoved()
 064    {
 065        insideState = 0; //state 0 does nothing
 066    }
 67
 68    public void ButtonPressed()
 069    {
 070        key.SetActive(false);
 071        spotlight.SetActive(false);
 072        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        }
 088    }
 89}