< Summary

Class:Collectible
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/unity-vr-maze_VRAgent/Assets/Maze/Scripts/Collectible.cs
Covered lines:9
Uncovered lines:11
Coverable lines:20
Total lines:53
Line coverage:45% (9 of 20)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:5
Method coverage:60% (3 of 5)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Collectible()0%000100%
Update()0%000100%
Collect()0%0000%
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
 6410    protected bool _isCollected = false;
 6411    protected Vector3 _rotationVector = new Vector3(0f, 1f, 0f);
 12
 13    // public settings
 14    public GameObject poof;
 6415    public float rotationSpeed = 150.0f;
 16
 17    [Header("Sounds")]
 6418    public AudioClip collect_sound = null;
 19
 20    protected void Update()
 781521    {
 22        // rotate object
 781523        gameObject.transform.Rotate(_rotationVector * rotationSpeed * Time.deltaTime);
 781524    }
 25
 26    public void Collect()
 027    {
 28        // Create poof
 029        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)
 032        AudioSource poofSound = poofInstance.GetComponent<AudioSource>();
 033        poofSound.clip = collect_sound;
 034        poofSound.Play();
 35
 36        // destroy collectible
 037        Object.Destroy(gameObject);
 38
 39        // set collected flag
 040        _isCollected = true;
 041    }
 42
 43    public bool isCollected()
 044    {
 045        return _isCollected;
 046    }
 47
 48    // Use this for initialization
 4549    void Start () {
 50
 4551  }
 52
 53}