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 SerializableEnvironmentColor(EnvironmentColor currentColor) { this.skyColor1 = currentColor.skyColor1; this.skyColor2 = currentColor.skyColor2; this.skyColor3 = currentColor.skyColor3; this.skyColor4 = currentColor.skyColor4; this.skyColor5 = currentColor.skyColor5; this.proportion = currentColor.proportion; }
public static EnvironmentColor Lerp(EnvironmentColor a, EnvironmentColor b, float amount) { return(new EnvironmentColor( Color.Lerp(a.skyColor1, b.skyColor1, amount), Color.Lerp(a.skyColor2, b.skyColor2, amount), Color.Lerp(a.skyColor3, b.skyColor3, amount), Color.Lerp(a.skyColor4, b.skyColor4, amount), Color.Lerp(a.skyColor5, b.skyColor5, amount), Mathf.Lerp(a.proportion, b.proportion, amount) )); }
private void Start() { this._previousColor = EnvironmentLibrary.BlueDusk; this.AssignColor(this._previousColor); }
public void AssignColor(EnvironmentColor color) { this._previousColor = EnvironmentColor.Lerp(this._previousColor, this._nextColor, this._currentColorLerp); this._nextColor = color; this._currentColorLerp = 0; }