< Summary

Class:XRTarget
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_subjects/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/VRExplorer_subjects/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()
 1030228    {
 1030229        livesText.text = "Health: " + health;
 30
 1385731        if(health <= 0) {
 355532            if (deathScreen.activeSelf)
 355433            {
 355434                enemies = GameObject.FindGameObjectsWithTag("Enemy");
 35
 1066236                foreach (GameObject enemy in enemies){
 037                    enemy.SetActive(false);
 038                }
 39
 355440                ray_Right.SetActive(true);
 355441                ray_Left.SetActive(true);
 42
 355443                LocomotionSystem.SetActive(false);
 44
 355445                TeleportManagerLeft.SetActive(false);
 355446                TeleportManagerRight.SetActive(false);
 47
 355448                deathScreen.SetActive(true);
 49
 355450                StartCoroutine(Wait());
 51
 52                //SceneManager.LoadScene(0);
 355453            }
 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
 355583        }
 1030284    }
 85
 86
 87    IEnumerator Wait()
 355588    {
 89        //yield on a new YieldInstruction that waits for 5 seconds.
 355590        yield return new WaitForSecondsRealtime(5);
 340291    }
 92
 93
 94    /// 'Hits' the target for a certain amount of damage
 4595    public void Hit(float damage) {
 4596        health -= damage;
 4597    }
 98
 99}

Methods/Properties

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