< 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()
 2468228    {
 2468229        livesText.text = "Health: " + health;
 30
 2802831        if(health <= 0) {
 334632            if (deathScreen.activeSelf)
 334433            {
 334434                enemies = GameObject.FindGameObjectsWithTag("Enemy");
 35
 1003236                foreach (GameObject enemy in enemies){
 037                    enemy.SetActive(false);
 038                }
 39
 334440                ray_Right.SetActive(true);
 334441                ray_Left.SetActive(true);
 42
 334443                LocomotionSystem.SetActive(false);
 44
 334445                TeleportManagerLeft.SetActive(false);
 334446                TeleportManagerRight.SetActive(false);
 47
 334448                deathScreen.SetActive(true);
 49
 334450                StartCoroutine(Wait());
 51
 52                //SceneManager.LoadScene(0);
 334453            }
 54            else
 255            {
 256                if (!deathScreen.activeSelf)
 257                {
 58
 259                    enemies = GameObject.FindGameObjectsWithTag("Enemy");
 60
 3661                    foreach (GameObject enemy in enemies){
 1062                        enemy.SetActive(false);
 1063                    }
 64
 65
 266                    ray_Right.SetActive(true);
 267                    ray_Left.SetActive(true);
 68
 269                    LocomotionSystem.SetActive(false);
 70
 271                    TeleportManagerLeft.SetActive(false);
 272                    TeleportManagerRight.SetActive(false);
 73
 274                    deathScreen.SetActive(true);
 75
 276                    StartCoroutine(Wait());
 77
 78                    //SceneManager.LoadScene(0);
 279                }
 80
 281            }
 82
 334683        }
 2468284    }
 85
 86
 87    IEnumerator Wait()
 334688    {
 89        //yield on a new YieldInstruction that waits for 5 seconds.
 334690        yield return new WaitForSecondsRealtime(5);
 200291    }
 92
 93
 94    /// 'Hits' the target for a certain amount of damage
 4995    public void Hit(float damage) {
 4996        health -= damage;
 4997    }
 98
 99}

Methods/Properties

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