< Summary

Class:Usable
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/EscapeTheRoomVR/Assets/Test 1/Usable.cs
Covered lines:0
Uncovered lines:11
Coverable lines:11
Total lines:24
Line coverage:0% (0 of 11)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:1
Method coverage:0% (0 of 1)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Use(...)0%0000%

File(s)

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

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4using UnityEngine.Events;
 5
 6public class Usable : Inspectable {
 7    public Item useItem;
 8    public string successMessage, failureMessage;
 9    public UnityEvent dispatch;  // Callback
 10
 011    public void Use(Inventory inv) {
 12        // Check if item matches what’s expected
 013        if (inv.SelectedItem == null) {
 014            Inspect(); // Item is not usable
 015        } else if (inv.SelectedItem == useItem) {
 016            Inspect(successMessage);
 017            inv.RemoveItem(useItem);
 018            if (dispatch != null) dispatch.Invoke();
 019        } else {
 020            Inspect(failureMessage);
 021        }
 022    }
 23}
 24

Methods/Properties

Use(Inventory)