| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCL.Skybox |
| | 6 | | { |
| | 7 | | [System.Serializable] |
| | 8 | | public class SkyboxSlots |
| | 9 | | { |
| 0 | 10 | | public bool enabled = true; |
| 0 | 11 | | public int slotID = -1; |
| | 12 | | public string slotName; |
| | 13 | | public bool expandedInEditor; |
| | 14 | | public float startTime = 0; |
| 0 | 15 | | public float endTime = 24; |
| 0 | 16 | | public List<TextureLayer> layers = new List<TextureLayer>(); |
| | 17 | |
|
| 0 | 18 | | public SkyboxSlots(int slotID, float startTime = 0, float endTime = 24) |
| | 19 | | { |
| 0 | 20 | | this.slotID = slotID; |
| 0 | 21 | | enabled = true; |
| 0 | 22 | | this.startTime = startTime; |
| 0 | 23 | | this.endTime = endTime; |
| 0 | 24 | | layers = new List<TextureLayer>(); |
| 0 | 25 | | } |
| | 26 | |
|
| 0 | 27 | | public void UpdateSlotsID(int slotID) { this.slotID = slotID; } |
| | 28 | |
|
| | 29 | | public void AddNewLayer(TextureLayer layer, bool addInFront = false) |
| | 30 | | { |
| 0 | 31 | | if (layer == null) |
| | 32 | | { |
| 0 | 33 | | return; |
| | 34 | | } |
| | 35 | |
|
| 0 | 36 | | if (addInFront) |
| | 37 | | { |
| 0 | 38 | | this.layers.Insert(0, layer); |
| 0 | 39 | | } |
| | 40 | | else |
| | 41 | | { |
| 0 | 42 | | this.layers.Add(layer); |
| | 43 | | } |
| 0 | 44 | | } |
| | 45 | |
|
| | 46 | | public TextureLayer GetActiveLayer(float currentTime) |
| | 47 | | { |
| 0 | 48 | | for (int i = 0; i < layers.Count; i++) |
| | 49 | | { |
| 0 | 50 | | if (layers[i].timeSpan_End < layers[i].timeSpan_start) |
| | 51 | | { |
| 0 | 52 | | if (currentTime >= layers[i].timeSpan_start || currentTime <= layers[i].timeSpan_End) |
| | 53 | | { |
| 0 | 54 | | if (layers[i].enabled) |
| | 55 | | { |
| 0 | 56 | | return layers[i]; |
| | 57 | | } |
| | 58 | | } |
| | 59 | | } |
| | 60 | | else |
| | 61 | | { |
| 0 | 62 | | if (currentTime >= layers[i].timeSpan_start && currentTime <= layers[i].timeSpan_End) |
| | 63 | | { |
| 0 | 64 | | if (layers[i].enabled) |
| | 65 | | { |
| 0 | 66 | | return layers[i]; |
| | 67 | | } |
| | 68 | | } |
| | 69 | | } |
| | 70 | | } |
| 0 | 71 | | return null; |
| | 72 | | } |
| | 73 | | } |
| | 74 | | } |