< Summary

Class:MovePillow
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/EscapeTheRoomVR/Assets/Test 1/MovePillow.cs
Covered lines:29
Uncovered lines:1
Coverable lines:30
Total lines:43
Line coverage:96.6% (29 of 30)
Covered branches:0
Total branches:0
Covered methods:6
Total methods:6
Method coverage:100% (6 of 6)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
MovePillow()0%000100%
Start()0%000100%
Update()0%00066.67%
SetInteractable(...)0%000100%
SetKey(...)0%000100%
MovePillowAway()0%000100%

File(s)

D:/--UnityProject/VR/_____ISSTA 26/EscapeTheRoomVR/Assets/Test 1/MovePillow.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5public class MovePillow : MonoBehaviour {
 26    public Lightable[] lamps = new Lightable[2];
 7    public GameObject key; // Hack to hide key
 28    bool isMoved = false;
 9
 110    void Start() {
 111        GetComponent<Inspectable>().enabled = false;
 112        GetComponent<Collectable>().enabled = false;
 113        GetComponent<Collider>().enabled = false;
 114        key.GetComponent<Collider>().enabled = false;
 115    }
 16
 274517    void Update() {
 274518        if (!isMoved && (lamps[0].on || lamps[1].on)) {
 019            SetInteractable (true);
 274520        } else {
 274521            SetInteractable (false);
 274522        }
 274523    }
 24
 274525    public void SetInteractable(bool status) {
 274526        GetComponent<Inspectable>().enabled = status;
 274527        GetComponent<Collectable>().enabled = status;
 274528        GetComponent<Collider>().enabled = status;
 274529    }
 30
 131    void SetKey(bool status) {
 232        if (key != null) {
 133            key.GetComponent<Collider> ().enabled = status;
 134        }
 135    }
 36
 37    // Move pillow aside to reveal the hidden key
 138    public void MovePillowAway() {
 139        transform.Translate(0.5f, 0, 0);
 140        isMoved = true;
 141        SetKey (true);
 142    }
 43}