< Summary

Class:Collectible
Assembly:Test
File(s):D:/--UnityProject/VR/subjects1_for_analysis/unity-vr-maze-master/unity-vr-maze-master/Assets/Maze/Scripts/Collectible.cs
Covered lines:20
Uncovered lines:0
Coverable lines:20
Total lines:53
Line coverage:100% (20 of 20)
Covered branches:0
Total branches:0
Covered methods:5
Total methods:5
Method coverage:100% (5 of 5)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Collectible()0%000100%
Update()0%000100%
Collect()0%000100%
isCollected()0%000100%
Start()0%000100%

File(s)

D:/--UnityProject/VR/subjects1_for_analysis/unity-vr-maze-master/unity-vr-maze-master/Assets/Maze/Scripts/Collectible.cs

#LineLine coverage
 1using UnityEngine;
 2using System.Collections;
 3
 4/**
 5 * This class will be used as parent for Coin and Key
 6 * Gives objects ability to be collected with poof and sound, also adds object rotation
 7 */
 8public class Collectible : MonoBehaviour {
 9
 3010    protected bool _isCollected = false;
 3011    protected Vector3 _rotationVector = new Vector3(0f, 1f, 0f);
 12
 13    // public settings
 14    public GameObject poof;
 3015    public float rotationSpeed = 150.0f;
 16
 17    [Header("Sounds")]
 3018    public AudioClip collect_sound = null;
 19
 20    protected void Update()
 112424721    {
 22        // rotate object
 112424723        gameObject.transform.Rotate(_rotationVector * rotationSpeed * Time.deltaTime);
 112424724    }
 25
 26    public void Collect()
 227    {
 28        // Create poof
 229        GameObject poofInstance = (GameObject)Object.Instantiate(poof, gameObject.transform.position, poof.transform.rot
 30
 31        // Play sounds using poof's audio source (because our original object will be destroyed)
 232        AudioSource poofSound = poofInstance.GetComponent<AudioSource>();
 233        poofSound.clip = collect_sound;
 234        poofSound.Play();
 35
 36        // destroy collectible
 237        Object.Destroy(gameObject);
 38
 39        // set collected flag
 240        _isCollected = true;
 241    }
 42
 43    public bool isCollected()
 144    {
 145        return _isCollected;
 146    }
 47
 48    // Use this for initialization
 1549    void Start () {
 50
 1551  }
 52
 53}