< Summary

Class:Round
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_subjects/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/VRExplorer_subjects/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)
 53420    {
 53421        Target target = other.gameObject.GetComponent<Target>();
 22
 53423        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
 53434        {
 53435            StartCoroutine(Wait());
 53436        }
 37
 53438        XRTarget XRTarget = other.gameObject.GetComponent<XRTarget>();
 39        // Only attempts to inflict damage if the other game object has
 40        // the 'EnemyAi' component
 53441        if (XRTarget != null)
 4942        {
 4943            Debug.Log("Hit");
 44
 4945            XRTarget.Hit(damage);
 46
 4947            Destroy(gameObject); // Deletes the round
 48
 4949        }
 50
 51        else
 48552        {
 48553            StartCoroutine(Wait());
 48554        }
 55
 53456        EnemyAi EnemyHealth = other.gameObject.GetComponent<EnemyAi>();
 57        // Only attempts to inflict damage if the other game object has
 58        // the 'EnemyAi' component
 53459        if (EnemyHealth != null)
 060        {
 061            Debug.Log("Hit");
 62
 063            EnemyHealth.TakeDamage(damage);
 64
 065            Destroy(gameObject); // Deletes the round
 66
 067        }
 68        else
 53469        {
 53470            StartCoroutine(Wait());
 71
 53472        }
 53473    }
 74
 75    IEnumerator Wait() //  <-  its a standalone method
 155376    {
 155377        Debug.Log("Hello");
 78        //wait 3 seconds
 155379        yield return new WaitForSeconds(5);
 7880        Debug.Log("Goodbye");
 7881        Destroy(gameObject); // Deletes the round
 7882    }
 83}