< 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 {
 56    public Lightable[] lamps = new Lightable[2];
 7    public GameObject key; // Hack to hide key
 58    bool isMoved = false;
 9
 210    void Start() {
 211        GetComponent<Inspectable>().enabled = false;
 212        GetComponent<Collectable>().enabled = false;
 213        GetComponent<Collider>().enabled = false;
 214        key.GetComponent<Collider>().enabled = false;
 215    }
 16
 645917    void Update() {
 645918        if (!isMoved && (lamps[0].on || lamps[1].on)) {
 019            SetInteractable (true);
 645920        } else {
 645921            SetInteractable (false);
 645922        }
 645923    }
 24
 645925    public void SetInteractable(bool status) {
 645926        GetComponent<Inspectable>().enabled = status;
 645927        GetComponent<Collectable>().enabled = status;
 645928        GetComponent<Collider>().enabled = status;
 645929    }
 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}