< Summary

Class:HouseController
Assembly:Assembly-CSharp
File(s):E:/Unity/Unity Project/Island-Visualizer-PCVR/Assets/Scripts/Test/HouseController.cs
Covered lines:18
Uncovered lines:5
Coverable lines:23
Total lines:46
Line coverage:78.2% (18 of 23)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:4
Method coverage:100% (4 of 4)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
HouseController()0%000100%
Start()0%000100%
Update()0%00037.5%
changeLights()0%00092.86%

File(s)

E:/Unity/Unity Project/Island-Visualizer-PCVR/Assets/Scripts/Test/HouseController.cs

#LineLine coverage
 1using UnityEngine;
 2
 3public class HouseController : MonoBehaviour
 4{
 5    public GameObject[] windowGlassObjects;
 6
 7    [ColorUsage(true, true)]
 8    public Color lightsOnEmissionColor;
 9
 10    [ColorUsage(true, true)]
 11    public Color lightsOffEmissionColor;
 12
 213    public bool lightStatus = false;
 214    private bool currentLightStatus = false;
 15    public AudioSource switchSound;
 16
 17    private void Start()
 118    {
 119        changeLights();
 120    }
 21
 22    private void Update()
 24923    {
 24924        if (currentLightStatus != lightStatus)
 025        {
 026            currentLightStatus = lightStatus;
 027            changeLights();
 028            switchSound.Play();
 029        }
 24930    }
 31
 32    public void changeLights()
 233    {
 234        Color colorChange = lightsOffEmissionColor;
 235        if (currentLightStatus == true) colorChange = lightsOnEmissionColor;
 2236        foreach (GameObject targetObject in windowGlassObjects)
 837        {
 838            Material targetMaterial = targetObject.GetComponent<Renderer>().material;
 39            // Set the new HDR color to the material's emission color property
 840            targetMaterial.SetColor("_EmissionColor", colorChange);
 41
 42            // Enable emission on the material (if it's not already enabled)
 843            targetMaterial.EnableKeyword("_EMISSION");
 844        }
 245    }
 46}