< Summary

Class:Round
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/VGuns-Unity-VR/Assets/Test/Round.cs
Covered lines:28
Uncovered lines:11
Coverable lines:39
Total lines:83
Line coverage:71.7% (28 of 39)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:2
Method coverage:100% (2 of 2)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnTriggerEnter(...)0%00066.67%
Wait()0%000100%

File(s)

D:/--UnityProject/VR/_____ISSTA 26/VGuns-Unity-VR/Assets/Test/Round.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using Unity.XR.CoreUtils;
 4using UnityEngine;
 5using UnityEngine.XR.Interaction.Toolkit;
 6
 7public class Round : MonoBehaviour
 8{
 9
 10    public GameObject self;
 11
 12    public GameObject explosion;
 13
 14    public Rigidbody Rigidbody;
 15
 16    public int damage;
 17
 18
 19    void OnTriggerEnter(Collider other)
 5820    {
 5821        Target target = other.gameObject.GetComponent<Target>();
 22
 5823        if (target != null)
 024        {
 025            Debug.Log("Hit");
 26
 027            target.Hit(damage);
 28
 029            Instantiate(explosion, self.transform.position, self.transform.rotation);
 30
 031            Destroy(gameObject); // Deletes the round
 032        }
 33        else
 5834        {
 5835            StartCoroutine(Wait());
 5836        }
 37
 5838        XRTarget XRTarget = other.gameObject.GetComponent<XRTarget>();
 39        // Only attempts to inflict damage if the other game object has
 40        // the 'EnemyAi' component
 5841        if (XRTarget != null)
 1042        {
 1043            Debug.Log("Hit");
 44
 1045            XRTarget.Hit(damage);
 46
 1047            Destroy(gameObject); // Deletes the round
 48
 1049        }
 50
 51        else
 4852        {
 4853            StartCoroutine(Wait());
 4854        }
 55
 5856        EnemyAi EnemyHealth = other.gameObject.GetComponent<EnemyAi>();
 57        // Only attempts to inflict damage if the other game object has
 58        // the 'EnemyAi' component
 5859        if (EnemyHealth != null)
 060        {
 061            Debug.Log("Hit");
 62
 063            EnemyHealth.TakeDamage(damage);
 64
 065            Destroy(gameObject); // Deletes the round
 66
 067        }
 68        else
 5869        {
 5870            StartCoroutine(Wait());
 71
 5872        }
 5873    }
 74
 75    IEnumerator Wait() //  <-  its a standalone method
 16476    {
 16477        Debug.Log("Hello");
 78        //wait 3 seconds
 16479        yield return new WaitForSeconds(5);
 11780        Debug.Log("Goodbye");
 11781        Destroy(gameObject); // Deletes the round
 11782    }
 83}