< Summary

Class:DCL.Skybox.SkyboxSlots
Assembly:ProceduralSkybox
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/SkyboxSlots.cs
Covered lines:0
Uncovered lines:27
Coverable lines:27
Total lines:74
Line coverage:0% (0 of 27)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SkyboxSlots(...)0%2100%
UpdateSlotsID(...)0%2100%
AddNewLayer(...)0%12300%
GetActiveLayer(...)0%90900%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/SkyboxSlots.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5namespace DCL.Skybox
 6{
 7    [System.Serializable]
 8    public class SkyboxSlots
 9    {
 010        public bool enabled = true;
 011        public int slotID = -1;
 12        public string slotName;
 13        public bool expandedInEditor;
 14        public float startTime = 0;
 015        public float endTime = 24;
 016        public List<TextureLayer> layers = new List<TextureLayer>();
 17
 018        public SkyboxSlots(int slotID, float startTime = 0, float endTime = 24)
 19        {
 020            this.slotID = slotID;
 021            enabled = true;
 022            this.startTime = startTime;
 023            this.endTime = endTime;
 024            layers = new List<TextureLayer>();
 025        }
 26
 027        public void UpdateSlotsID(int slotID) { this.slotID = slotID; }
 28
 29        public void AddNewLayer(TextureLayer layer, bool addInFront = false)
 30        {
 031            if (layer == null)
 32            {
 033                return;
 34            }
 35
 036            if (addInFront)
 37            {
 038                this.layers.Insert(0, layer);
 39            }
 40            else
 41            {
 042                this.layers.Add(layer);
 43            }
 044        }
 45
 46        public TextureLayer GetActiveLayer(float currentTime)
 47        {
 048            for (int i = 0; i < layers.Count; i++)
 49            {
 050                if (layers[i].timeSpan_End < layers[i].timeSpan_start)
 51                {
 052                    if (currentTime >= layers[i].timeSpan_start || currentTime <= layers[i].timeSpan_End)
 53                    {
 054                        if (layers[i].enabled)
 55                        {
 056                            return layers[i];
 57                        }
 58                    }
 59                }
 60                else
 61                {
 062                    if (currentTime >= layers[i].timeSpan_start && currentTime <= layers[i].timeSpan_End)
 63                    {
 064                        if (layers[i].enabled)
 65                        {
 066                            return layers[i];
 67                        }
 68                    }
 69                }
 70            }
 071            return null;
 72        }
 73    }
 74}