Пример #1
0
 private void EvaluateAtmosphere()
 {
     if (this.UpdateAtmosphereWithTransition)
     {
         int num = this.AtmosphereConfigSeries.KeyBeforeTime(this.DayTime);
         if (num != this._currentKey)
         {
             if (!this.IsInTransition)
             {
                 this._nextKey              = num;
                 this.IsInTransition        = true;
                 this._remainTransitionTime = this.AtmosphereConfigSeries.Common.TransitionTime;
                 base.StartCoroutine(this.TransitAtmosphere());
             }
             else if (num != this._nextKey)
             {
                 this._nextKey = num;
                 this._remainTransitionTime = this.AtmosphereConfigSeries.Common.TransitionTime;
             }
         }
     }
     else if (!this.IsInTransition)
     {
         this._needUpdateAtmosphere = true;
         this._currentKey           = this._atmosphereConfigSeries.KeyBeforeTime(this.DayTime);
         this._atmosphereConfig     = this._atmosphereConfigSeries.Evaluate(this.DayTime, true);
     }
 }
Пример #2
0
        public static ConfigAtmosphere Lerp(ConfigAtmosphere config1, ConfigAtmosphere config2, float t)
        {
            ConfigAtmosphere atmosphere;

            return(new ConfigAtmosphere {
                FrameTime = Mathf.Lerp(config1.FrameTime, config2.FrameTime, t), Name = atmosphere.FrameTime.ToString(), CloudStyle = ConfigCloudStyle.Lerp(config1.CloudStyle, config2.CloudStyle, t), Background = ConfigBackground.Lerp(config1.Background, config2.Background, t), Indoor = ConfigIndoor.Lerp(config1.Indoor, config2.Indoor, t)
            });
        }
Пример #3
0
 public void SetupAtmosphere(ConfigAtmosphereCommon commonConfig, ConfigAtmosphere config)
 {
     if (this._skyMPB == null)
     {
         this.Init();
     }
     this.SetupSky(commonConfig, config.Background);
     this._cloudEmitter.SetupCloudConfig(commonConfig, config.CloudStyle);
     this.SetupIndoor(config.Indoor);
 }
Пример #4
0
        public static ScriptableConfigAtmosphere ToScriptable(ConfigAtmosphere source)
        {
            if (source == null)
            {
                return(null);
            }
            ScriptableConfigAtmosphere atmosphere = ScriptableObject.CreateInstance <ScriptableConfigAtmosphere>();

            atmosphere.name       = source.Name;
            atmosphere.FrameTime  = source.FrameTime;
            atmosphere.CloudStyle = source.CloudStyle;
            atmosphere.Background = source.Background;
            atmosphere.Indoor     = source.Indoor;
            return(atmosphere);
        }
Пример #5
0
        public bool Evaluate(float time, out ConfigAtmosphere config)
        {
            int key = this.KeyBeforeTime(time);

            if (this._fistEvaluate)
            {
                this._fistEvaluate = false;
                config             = this.Value(key);
                this._lastKey      = key;
                return(true);
            }
            if (!this._inTransition)
            {
                if (key == this._lastKey)
                {
                    config        = this.Value(key);
                    this._lastKey = key;
                    return(false);
                }
                this._inTransition = true;
                this._beginTime    = time;
                this._duration     = 0f;
                this._beginKey     = this._lastKey;
                this._lastKey      = key;
            }
            else if (key != this._lastKey)
            {
                this._lastKey   = key;
                this._beginTime = time - this._duration;
            }
            else
            {
                this._duration = time - this._beginTime;
            }
            float t = (this._duration * 3600f) / this.Common.TransitionTime;

            if (t > 1f)
            {
                this._inTransition = false;
                config             = this.Value(key);
                this._lastKey      = key;
            }
            else
            {
                config = ConfigAtmosphere.Lerp(this.Value(this._beginKey), this.Value(key), t);
            }
            return(true);
        }
Пример #6
0
        public ConfigAtmosphere Evaluate(float time, bool isEditorMode)
        {
            float num;
            float num2;
            float num5;

            if (this.SortedConfigList == null)
            {
                return(null);
            }
            if (!this.GetTimeRange(time, out num, out num2))
            {
                return(null);
            }
            float num3 = time - num;
            float a    = num2 - num;

            if (num3 < 0f)
            {
                num3 += 24f;
            }
            if (a < 0f)
            {
                a += 24f;
            }
            if (isEditorMode)
            {
                num5          = num3 / a;
                this._lastKey = this.KeyAtTime(num);
                return(ConfigAtmosphere.Lerp(this.SortedConfigList[num], this.SortedConfigList[num2], num5));
            }
            a = Mathf.Min(a, this.Common.TransitionTime / 3600f);
            int key = this.KeyBeforeTime(num - MIN_KEY_INTERVAL);

            if (a < float.Epsilon)
            {
                num5 = 1f;
            }
            else
            {
                num5 = Mathf.Clamp01(num3 / a);
            }
            this._lastKey = key;
            return(ConfigAtmosphere.Lerp(this.Value(key), this.SortedConfigList[num], num5));
        }
Пример #7
0
 public void ChooseCloudScene(ConfigAtmosphereSeries config, int sceneId)
 {
     if ((config != null) && config.IsValid())
     {
         this._atmosphereConfigSeries    = config;
         this.AtmosphereConfigSeriesPath = config.Path;
         int    num = this.AtmosphereConfigSeriesPath.LastIndexOf('/');
         string str = this.AtmosphereConfigSeriesPath.Substring(num + 1);
         this._atmosphereConfigSeriesId = AtmosphereSeriesData.GetId(this.AtmosphereConfigSeriesPath);
         this._atmosphereConfigSeries.SetSceneId(sceneId);
         this._currentKey           = this.AtmosphereConfigSeries.KeyBeforeTime(this.DayTime);
         this._nextKey              = this._currentKey;
         this._atmosphereConfig     = this.AtmosphereConfigSeries.Value(this._currentKey);
         this._needUpdateAtmosphere = true;
         this.IsInTransition        = false;
         this.ReleaseBackgroundRenderTexture();
         this._cloudEmitter.gameObject.SetActive(true);
         this.UpdateAtmosphere();
     }
 }
Пример #8
0
 public void Add(ConfigAtmosphere config)
 {
     this.SortedConfigList.Add(config.FrameTime, config);
     this.ConfigList = new ConfigAtmosphere[this.SortedConfigList.Count];
     this.SortedConfigList.Values.CopyTo(this.ConfigList, 0);
 }
Пример #9
0
 public int CompareTo(ConfigAtmosphere target)
 {
     return(this.FrameTime.CompareTo(target.FrameTime));
 }