< Summary

Class:XRTarget
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/VGuns-Unity-VR/Assets/Test/XRTarget.cs
Covered lines:39
Uncovered lines:2
Coverable lines:41
Total lines:99
Line coverage:95.1% (39 of 41)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:3
Method coverage:100% (3 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Update()0%00090.91%
Wait()0%000100%
Hit(...)0%000100%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using TMPro;
 5using UnityEngine;
 6using UnityEngine.SceneManagement;
 7
 8public class XRTarget : MonoBehaviour {
 9
 10    public float health;
 11
 12    public TextMeshPro livesText;
 13
 14    public GameObject deathScreen;
 15
 16    public GameObject LocomotionSystem;
 17
 18    public GameObject ray_Right;
 19    public GameObject ray_Left;
 20
 21    public GameObject TeleportManagerLeft;
 22    public GameObject TeleportManagerRight;
 23
 24    public GameObject[] enemies;
 25
 26
 27    void Update()
 363128    {
 363129        livesText.text = "Health: " + health;
 30
 368931        if(health <= 0) {
 5832            if (deathScreen.activeSelf)
 5733            {
 5734                enemies = GameObject.FindGameObjectsWithTag("Enemy");
 35
 17136                foreach (GameObject enemy in enemies){
 037                    enemy.SetActive(false);
 038                }
 39
 5740                ray_Right.SetActive(true);
 5741                ray_Left.SetActive(true);
 42
 5743                LocomotionSystem.SetActive(false);
 44
 5745                TeleportManagerLeft.SetActive(false);
 5746                TeleportManagerRight.SetActive(false);
 47
 5748                deathScreen.SetActive(true);
 49
 5750                StartCoroutine(Wait());
 51
 52                //SceneManager.LoadScene(0);
 5753            }
 54            else
 155            {
 156                if (!deathScreen.activeSelf)
 157                {
 58
 159                    enemies = GameObject.FindGameObjectsWithTag("Enemy");
 60
 1861                    foreach (GameObject enemy in enemies){
 562                        enemy.SetActive(false);
 563                    }
 64
 65
 166                    ray_Right.SetActive(true);
 167                    ray_Left.SetActive(true);
 68
 169                    LocomotionSystem.SetActive(false);
 70
 171                    TeleportManagerLeft.SetActive(false);
 172                    TeleportManagerRight.SetActive(false);
 73
 174                    deathScreen.SetActive(true);
 75
 176                    StartCoroutine(Wait());
 77
 78                    //SceneManager.LoadScene(0);
 179                }
 80
 181            }
 82
 5883        }
 363184    }
 85
 86
 87    IEnumerator Wait()
 5888    {
 89        //yield on a new YieldInstruction that waits for 5 seconds.
 5890        yield return new WaitForSecondsRealtime(5);
 2991    }
 92
 93
 94    /// 'Hits' the target for a certain amount of damage
 1095    public void Hit(float damage) {
 1096        health -= damage;
 1097    }
 98
 99}

Methods/Properties

Update()
Wait()
Hit(System.Single)