| | 1 | | using System; |
| | 2 | | using System.Collections; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL.Skybox |
| | 7 | | { |
| | 8 | | [System.Serializable] |
| | 9 | | public class Config3DDome : Config3DBase |
| | 10 | | { |
| 0 | 11 | | public TextureLayer layers = new TextureLayer(); |
| 0 | 12 | | public float domeRadius = SkyboxUtils.DOME_DEFAULT_SIZE; |
| | 13 | |
|
| 0 | 14 | | public Config3DDome(string name) |
| | 15 | | { |
| 0 | 16 | | configType = Additional3DElements.Dome; |
| 0 | 17 | | layers = new TextureLayer(name); |
| 0 | 18 | | } |
| | 19 | |
|
| | 20 | | public override bool IsConfigActive(float currentTime, float cycleTime = 24) |
| | 21 | | { |
| 0 | 22 | | bool configActive = false; |
| | 23 | |
|
| 0 | 24 | | if (!enabled) |
| | 25 | | { |
| 0 | 26 | | layers.renderType = LayerRenderType.NotRendering; |
| 0 | 27 | | return configActive; |
| | 28 | | } |
| | 29 | |
|
| | 30 | |
|
| 0 | 31 | | float endTimeEdited = layers.timeSpan_End; |
| 0 | 32 | | float dayTimeEdited = currentTime; |
| | 33 | |
|
| 0 | 34 | | if (layers.timeSpan_End < layers.timeSpan_start) |
| | 35 | | { |
| 0 | 36 | | endTimeEdited = cycleTime + layers.timeSpan_End; |
| 0 | 37 | | if (currentTime < layers.timeSpan_start) |
| | 38 | | { |
| 0 | 39 | | dayTimeEdited = cycleTime + currentTime; |
| | 40 | | } |
| | 41 | | } |
| | 42 | |
|
| 0 | 43 | | if (dayTimeEdited >= layers.timeSpan_start && dayTimeEdited <= endTimeEdited) |
| | 44 | | { |
| 0 | 45 | | configActive = true; |
| 0 | 46 | | layers.renderType = LayerRenderType.Rendering; |
| 0 | 47 | | } |
| | 48 | | else |
| | 49 | | { |
| 0 | 50 | | layers.renderType = LayerRenderType.NotRendering; |
| | 51 | | } |
| | 52 | |
|
| 0 | 53 | | return configActive; |
| | 54 | | } |
| | 55 | |
|
| | 56 | | public Config3DDome DeepCopy() |
| | 57 | | { |
| 0 | 58 | | Config3DDome dome = (Config3DDome)this.MemberwiseClone(); |
| 0 | 59 | | dome.layers = layers.DeepCopy(); |
| 0 | 60 | | return dome; |
| | 61 | | } |
| | 62 | | } |
| | 63 | | } |