private void Update() { this._currentColorLerp = Mathf.Min(this._currentColorLerp += this._lerpSpeed * Time.deltaTime, 1); var currentColor = EnvironmentColor.Lerp(this._previousColor, this._nextColor, this._currentColorLerp); if (this.useDebugColor) { currentColor = this.debugColor.ToEnvironmentColor(); this.debugColorCodeOutput = this.debugColor.ToCodeString(); } else { this.debugColor = new SerializableEnvironmentColor(currentColor); } this.groundMaterial.SetColor("_Color", currentColor.GroundColor); this.skyMaterial.SetColor("_Color1", currentColor.skyColor1); this.skyMaterial.SetColor("_Color2", currentColor.skyColor2); this.skyMaterial.SetColor("_Color3", currentColor.skyColor3); this.skyMaterial.SetColor("_Color4", currentColor.skyColor4); this.skyMaterial.SetColor("_Color5", currentColor.skyColor5); this.skyMaterial.SetFloat("_Proportion", currentColor.proportion); this.SetMountainRangeColors(0, currentColor.Mountain1Color1, currentColor.Mountain1Color2); this.SetMountainRangeColors(1, currentColor.Mountain2Color1, currentColor.Mountain2Color2); this.SetMountainRangeColors(2, currentColor.Mountain3Color1, currentColor.Mountain3Color2); if (this.starfield != null) { this.starfield.SetColors(currentColor.StarMainColor, currentColor.StarColor1, currentColor.StarColor2, currentColor.skyColor1.Brightness()); } }
public void AssignColor(EnvironmentColor color) { this._previousColor = EnvironmentColor.Lerp(this._previousColor, this._nextColor, this._currentColorLerp); this._nextColor = color; this._currentColorLerp = 0; }