示例#1
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);
        }
示例#2
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));
        }