< Summary

Class:DisplaySelectedObject
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/EscapeTheRoomVR/Assets/Test 1/DisplaySelectedObject.cs
Covered lines:27
Uncovered lines:29
Coverable lines:56
Total lines:80
Line coverage:48.2% (27 of 56)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:6
Method coverage:66.6% (4 of 6)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
DisplaySelectedObject()0%000100%
OnEnable()0%00073.33%
TurnOffAll()0%000100%
TurnSelectedWithButton(...)0%000100%
TemporalMethodArrangeModels()0%0000%
TemporalPlaceArrangeModels()0%0000%

File(s)

D:/--UnityProject/VR/_____ISSTA 26/EscapeTheRoomVR/Assets/Test 1/DisplaySelectedObject.cs

#LineLine coverage
 1using UnityEngine;
 2using System.Collections;
 3
 4[ExecuteInEditMode]
 5public class DisplaySelectedObject : MonoBehaviour {
 6  public GameObject[] displayOptions; //Do not comment or change this variable, local values have been assigned to every
 7  public int currentDisplay;
 8  private int oldDisplay;
 109  public int temporalGOArrange=0;    //Temporal Variable
 1010  public bool ButtonSelectable=true;
 11
 1012  void OnEnable () {
 13    //temporalGOArrange = 0;
 1014    if (temporalGOArrange == 1) {    //Temporal script
 015      TemporalMethodArrangeModels ();
 016      TemporalPlaceArrangeModels();
 1017    } else {
 2018      if (displayOptions.Length > 0) {
 1019        TurnOffAll ();                                   //Activate off every object in the array
 1020        displayOptions [currentDisplay].SetActive (true);                 //Activate on the currently selected GameObjec
 1021        oldDisplay = currentDisplay;                           //Since the gameObject we needed is already Activated, we
 1022      }
 1023    }
 1024  }
 25
 26
 1027  void TurnOffAll(){
 2028    if (displayOptions.Length > 0) {
 27229      for (int i=0; i<displayOptions.Length; i++) {
 8430        displayOptions [i].SetActive (false);                     //turn off every GameObject Iniside displayOptions Arr
 8431      }
 1032    }
 1033  }
 34
 12535  public void TurnSelectedWithButton(int curDisp){
 12536    currentDisplay = curDisp;
 24337    if (curDisp != oldDisplay) {
 11838      displayOptions [oldDisplay].SetActive(false);
 11839      displayOptions [curDisp].SetActive(true);
 11840      oldDisplay=curDisp;
 11841    }
 42
 12543  }
 44
 045  void TemporalMethodArrangeModels(){    //TemporalScript
 046    Transform[] transformChild = GetComponentsInChildren<Transform> ();
 047    int childCounter=0;
 048    int childAssign=0;
 049    for (int i=1; i<transformChild.Length; i++) {
 050      if (transformChild[i].parent.gameObject==this.gameObject)childCounter++;
 051    }
 052    displayOptions=new GameObject[childCounter];
 053    for (int j=1; j<transformChild.Length; j++) {
 054      if (transformChild[j].parent.gameObject==this.gameObject){
 055        displayOptions[childAssign]=transformChild[j].gameObject;
 056        childAssign++;
 057      }
 58      //displayOptions=new GameObject[1];
 059    }
 060    childCounter = 0;
 061    childAssign = 0;
 62
 063  }
 064  void TemporalPlaceArrangeModels(){
 065    Transform[] transformChild = GetComponentsInChildren<Transform> ();
 066    for (int i=1; i<transformChild.Length; i++) {
 067      for (int j=0;j<displayOptions.Length;j++){
 068        if (displayOptions[j].name.Contains(i+"_")){
 069          displayOptions[j].transform.SetAsLastSibling();
 070        }
 71//        if (displayOptions[j].name.Contains("Wood Atlas"))displayOptions[j].transform.SetAsLastSibling();
 72//        //if (displayOptions[j].name.Contains("Marble Atlas"))displayOptions[j].transform.SetAsLastSibling();
 73//        if (displayOptions[j].name.Contains("Metal Atlas"))displayOptions[j].transform.SetAsLastSibling();
 74//        if (displayOptions[j].name.Contains("Plastic Atlas"))displayOptions[j].transform.SetAsLastSibling();
 75//        if (displayOptions[j].name.Contains("Quarry Atlas"))displayOptions[j].transform.SetAsLastSibling();
 76//        if (displayOptions[j].name.Contains("Glass Shine"))displayOptions[j].transform.SetAsLastSibling();
 077      }
 078    }
 079  }
 80}