< Summary

Class:Collectible
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/unity-vr-maze_VRAgent/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/_____ISSTA 26/unity-vr-maze_VRAgent/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()
 2903421    {
 22        // rotate object
 2903423        gameObject.transform.Rotate(_rotationVector * rotationSpeed * Time.deltaTime);
 2903424    }
 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()
 044    {
 045        return _isCollected;
 046    }
 47
 48    // Use this for initialization
 1549    void Start () {
 50
 1551  }
 52
 53}