< Summary

Class:LoopManager
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_subjects/Edutainment-Escape-Room/Assets/Scripts/Test/LoopTask/LoopManager.cs
Covered lines:22
Uncovered lines:35
Coverable lines:57
Total lines:89
Line coverage:38.5% (22 of 57)
Covered branches:0
Total branches:0
Covered methods:6
Total methods:10
Method coverage:60% (6 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%000100%
insideKey()0%0000%
insideLight()0%0000%
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
 812    [SerializeField] private int outsideState = 0; //used to keep track of which piece is put in the outside socket
 813    [SerializeField] private int insideState = 0; //used to keep track of which piece is put in the inside socket
 14
 815    private bool showShort = false;
 816    private float ifTimer = 0;
 17
 18    private void Start()
 719    {
 720        key.SetActive(false);
 721        spotlight.SetActive(false);
 722    }
 23
 24    private void Update()
 2640225    {
 2640226        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        }
 2640237    }
 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()
 450    {
 451        outsideState = 0; //state 0 means running function will do nothing
 452    }
 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()
 464    {
 465        insideState = 0; //state 0 does nothing
 466    }
 67
 68    public void ButtonPressed()
 469    {
 470        key.SetActive(false);
 471        spotlight.SetActive(false);
 472        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        }
 488    }
 89}