mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix burnt star colours
This commit is contained in:
parent
850500392f
commit
2280ba3b83
@ -197,12 +197,19 @@ namespace NewHorizons.Builder.Body
|
|||||||
var giantMaterial = sun.GetComponent<SunController>().GetValue<Material>("_endSurfaceMaterial");
|
var giantMaterial = sun.GetComponent<SunController>().GetValue<Material>("_endSurfaceMaterial");
|
||||||
|
|
||||||
surface.sharedMaterial = new Material(starModule.Size >= 3000 ? giantMaterial : mainSequenceMaterial);
|
surface.sharedMaterial = new Material(starModule.Size >= 3000 ? giantMaterial : mainSequenceMaterial);
|
||||||
var mod = Mathf.Max(0.5f, 2f * Mathf.Sqrt(starModule.SolarLuminosity));
|
var mod = Mathf.Max(1f, 2f * Mathf.Sqrt(starModule.SolarLuminosity));
|
||||||
var adjustedColour = new Color(colour.r * mod, colour.g * mod, colour.b * mod);
|
var adjustedColour = new Color(colour.r * mod, colour.g * mod, colour.b * mod);
|
||||||
surface.sharedMaterial.color = adjustedColour;
|
surface.sharedMaterial.color = adjustedColour;
|
||||||
|
|
||||||
Color.RGBToHSV(adjustedColour, out float H, out float S, out float V);
|
Color.RGBToHSV(adjustedColour, out float H, out float S, out float V);
|
||||||
var darkenedColor = Color.HSVToRGB(H, S, V * 0.05f);
|
var darkenedColor = Color.HSVToRGB(H, S * 1.2f, V * 0.05f);
|
||||||
|
|
||||||
|
if (starModule.EndTint != null)
|
||||||
|
{
|
||||||
|
var endColour = starModule.EndTint.ToColor();
|
||||||
|
darkenedColor = new Color(endColour.r * mod, endColour.g * mod, endColour.b * mod);
|
||||||
|
}
|
||||||
|
|
||||||
surface.sharedMaterial.SetTexture("_ColorRamp", ImageUtilities.LerpGreyscaleImage(_colorOverTime, adjustedColour, darkenedColor));
|
surface.sharedMaterial.SetTexture("_ColorRamp", ImageUtilities.LerpGreyscaleImage(_colorOverTime, adjustedColour, darkenedColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,6 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
public GameObject atmosphere;
|
public GameObject atmosphere;
|
||||||
public SupernovaEffectController supernova;
|
public SupernovaEffectController supernova;
|
||||||
public bool willExplode;
|
public bool willExplode;
|
||||||
|
|
||||||
public MColor startColour { get; set; }
|
public MColor startColour { get; set; }
|
||||||
public MColor endColour { get; set; }
|
public MColor endColour { get; set; }
|
||||||
|
|
||||||
@ -149,14 +148,21 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
{
|
{
|
||||||
base.FixedUpdate();
|
base.FixedUpdate();
|
||||||
|
|
||||||
|
// Only do colour transition stuff if they set an end colour
|
||||||
|
if (endColour != null)
|
||||||
|
{
|
||||||
// Use the age if theres no resizing happening, else make it get redder the larger it is or wtv
|
// Use the age if theres no resizing happening, else make it get redder the larger it is or wtv
|
||||||
var t = ageValue;
|
var t = ageValue;
|
||||||
if(maxScale > 0) t = CurrentScale / maxScale;
|
if (maxScale > 0) t = CurrentScale / maxScale;
|
||||||
currentColour = Color.Lerp(_startColour, _endColour, t);
|
currentColour = Color.Lerp(_startColour, _endColour, t);
|
||||||
|
|
||||||
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t);
|
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
currentColour = _startColour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// When its collapsing we directly take over the scale
|
// When its collapsing we directly take over the scale
|
||||||
var t = _collapseTimer / collapseTime;
|
var t = _collapseTimer / collapseTime;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user