< Summary

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

Coverage History

Metrics

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

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()
 339328    {
 339329        livesText.text = "Health: " + health;
 30
 339331        if(health <= 0) {
 032            if (deathScreen.activeSelf)
 033            {
 034                enemies = GameObject.FindGameObjectsWithTag("Enemy");
 35
 036                foreach (GameObject enemy in enemies){
 037                    enemy.SetActive(false);
 038                }
 39
 040                ray_Right.SetActive(true);
 041                ray_Left.SetActive(true);
 42
 043                LocomotionSystem.SetActive(false);
 44
 045                TeleportManagerLeft.SetActive(false);
 046                TeleportManagerRight.SetActive(false);
 47
 048                deathScreen.SetActive(true);
 49
 050                StartCoroutine(Wait());
 51
 52                //SceneManager.LoadScene(0);
 053            }
 54            else
 055            {
 056                if (!deathScreen.activeSelf)
 057                {
 58
 059                    enemies = GameObject.FindGameObjectsWithTag("Enemy");
 60
 061                    foreach (GameObject enemy in enemies){
 062                        enemy.SetActive(false);
 063                    }
 64
 65
 066                    ray_Right.SetActive(true);
 067                    ray_Left.SetActive(true);
 68
 069                    LocomotionSystem.SetActive(false);
 70
 071                    TeleportManagerLeft.SetActive(false);
 072                    TeleportManagerRight.SetActive(false);
 73
 074                    deathScreen.SetActive(true);
 75
 076                    StartCoroutine(Wait());
 77
 78                    //SceneManager.LoadScene(0);
 079                }
 80
 081            }
 82
 083        }
 339384    }
 85
 86
 87    IEnumerator Wait()
 088    {
 89        //yield on a new YieldInstruction that waits for 5 seconds.
 090        yield return new WaitForSecondsRealtime(5);
 091    }
 92
 93
 94    /// 'Hits' the target for a certain amount of damage
 095    public void Hit(float damage) {
 096        health -= damage;
 097    }
 98
 99}

Methods/Properties

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