< 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:17
Uncovered lines:3
Coverable lines:20
Total lines:53
Line coverage:85% (17 of 20)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:5
Method coverage:80% (4 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%0000%
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()
 25906921    {
 22        // rotate object
 25906923        gameObject.transform.Rotate(_rotationVector * rotationSpeed * Time.deltaTime);
 25906924    }
 25
 26    public void Collect()
 127    {
 28        // Create poof
 129        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)
 132        AudioSource poofSound = poofInstance.GetComponent<AudioSource>();
 133        poofSound.clip = collect_sound;
 134        poofSound.Play();
 35
 36        // destroy collectible
 137        Object.Destroy(gameObject);
 38
 39        // set collected flag
 140        _isCollected = true;
 141    }
 42
 43    public bool isCollected()
 044    {
 045        return _isCollected;
 046    }
 47
 48    // Use this for initialization
 1549    void Start () {
 50
 1551  }
 52
 53}