Prevent star bug at end of life

This commit is contained in:
Nick 2022-07-14 23:00:28 -04:00
parent 69b3e405f3
commit 861f061e95

View File

@ -145,16 +145,21 @@ namespace NewHorizons.Components.SizeControllers
private void UpdateMainSequence() private void UpdateMainSequence()
{ {
var ageValue = _age / (lifespan * 60f);
// Only do colour transition stuff if they set an end colour // Only do colour transition stuff if they set an end colour
if (EndColour != null) 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 = _age / (lifespan * 60f);
if (maxScale > 0) t = CurrentScale / maxScale; if (maxScale > 0) t = CurrentScale / maxScale;
_currentColour = Color.Lerp(_startColour, _endColour, t); if (t < 1f)
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t); {
_currentColour = Color.Lerp(_startColour, _endColour, t);
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t);
}
else
{
_currentColour = _endColour;
}
} }
else else
{ {
@ -263,9 +268,11 @@ namespace NewHorizons.Components.SizeControllers
{ {
lod.material.SetFloat("_InnerRadius", CurrentScale); lod.material.SetFloat("_InnerRadius", CurrentScale);
lod.material.SetFloat("_OuterRadius", CurrentScale * StarBuilder.OuterRadiusRatio); lod.material.SetFloat("_OuterRadius", CurrentScale * StarBuilder.OuterRadiusRatio);
lod.material.SetColor("_AtmosFar", _currentColour);
lod.material.SetColor("_AtmosNear", _currentColour); // These break once it reaches endColour and I have no idea why
lod.material.SetColor("_SkyColor", _currentColour); //lod.material.SetColor("_AtmosFar", _currentColour);
//lod.material.SetColor("_AtmosNear", _currentColour);
//lod.material.SetColor("_SkyColor", _currentColour);
} }
} }
} }