Fix wrong star end tint (#237)

This commit is contained in:
Noah 2022-07-14 20:16:43 -04:00 committed by GitHub
commit 08b737a554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions

View File

@ -137,9 +137,9 @@ namespace NewHorizons.Builder.Body
controller.size = starModule.size; controller.size = starModule.size;
controller.atmosphere = sunAtmosphere; controller.atmosphere = sunAtmosphere;
controller.supernova = supernova; controller.supernova = supernova;
controller.startColour = starModule.tint?.ToColor(); controller.StartColour = starModule.tint;
controller.endColour = starModule.tint != null ? starModule.tint.ToColor() * 4.5948f : null; controller.EndColour = starModule.endTint;
controller.willExplode = starModule.goSupernova; controller.WillExplode = starModule.goSupernova;
if (!string.IsNullOrEmpty(starModule.starRampTexture)) if (!string.IsNullOrEmpty(starModule.starRampTexture))
{ {
var ramp = ImageUtilities.GetTexture(mod, starModule.starRampTexture); var ramp = ImageUtilities.GetTexture(mod, starModule.starRampTexture);
@ -187,8 +187,8 @@ namespace NewHorizons.Builder.Body
if (starModule.curve != null) controller.SetScaleCurve(starModule.curve); if (starModule.curve != null) controller.SetScaleCurve(starModule.curve);
controller.size = starModule.size; controller.size = starModule.size;
controller.supernova = supernova; controller.supernova = supernova;
controller.startColour = starModule.tint?.ToColor(); controller.StartColour = starModule.tint;
controller.endColour = starModule.tint != null ? starModule.tint.ToColor() * 4.5948f : null; controller.EndColour = starModule.endTint;
controller.enabled = true; controller.enabled = true;
starGO.SetActive(true); starGO.SetActive(true);

View File

@ -15,9 +15,9 @@ namespace NewHorizons.Components.SizeControllers
{ {
public GameObject atmosphere; public GameObject atmosphere;
public SupernovaEffectController supernova; public SupernovaEffectController supernova;
public bool willExplode; public bool WillExplode { get; set; }
public Color? startColour; public MColor StartColour { get; set; }
public Color? endColour; public MColor EndColour { get; set; }
public Texture normalRamp; public Texture normalRamp;
public Texture collapseRamp; public Texture collapseRamp;
@ -84,25 +84,25 @@ namespace NewHorizons.Components.SizeControllers
_startSurfaceMaterial.SetTexture(ColorRamp, _normalRamp); _startSurfaceMaterial.SetTexture(ColorRamp, _normalRamp);
_endSurfaceMaterial.SetTexture(ColorRamp, _normalRamp); _endSurfaceMaterial.SetTexture(ColorRamp, _normalRamp);
if (startColour == null) if (StartColour == null)
{ {
_startColour = _startSurfaceMaterial.color; _startColour = _startSurfaceMaterial.color;
} }
else else
{ {
_startColour = startColour.Value; _startColour = StartColour.ToColor();
_startSurfaceMaterial.color = _startColour; _startSurfaceMaterial.color = _startColour;
} }
if (endColour == null) if (EndColour == null)
{ {
_endColour = _startColour; _endColour = _startColour;
_endSurfaceMaterial.color = _startColour; _endSurfaceMaterial.color = _startColour;
} }
else else
{ {
_endColour = endColour.Value; _endColour = EndColour.ToColor();
_endSurfaceMaterial.color = _endColour; _endSurfaceMaterial.color = _startColour * 4.5948f;
} }
_heatVolume = GetComponentInChildren<HeatHazardVolume>(); _heatVolume = GetComponentInChildren<HeatHazardVolume>();
@ -114,7 +114,7 @@ namespace NewHorizons.Components.SizeControllers
_atmosphereRenderers = atmosphere?.transform?.Find("AtmoSphere")?.GetComponentsInChildren<MeshRenderer>(); _atmosphereRenderers = atmosphere?.transform?.Find("AtmoSphere")?.GetComponentsInChildren<MeshRenderer>();
} }
if (willExplode) GlobalMessenger.AddListener("TriggerSupernova", Die); if (WillExplode) GlobalMessenger.AddListener("TriggerSupernova", Die);
if (scaleCurve != null) if (scaleCurve != null)
{ {
@ -132,7 +132,7 @@ namespace NewHorizons.Components.SizeControllers
public void OnDestroy() public void OnDestroy()
{ {
if (willExplode) GlobalMessenger.RemoveListener("TriggerSupernova", Die); if (WillExplode) GlobalMessenger.RemoveListener("TriggerSupernova", Die);
} }
public void SetProxy(StarEvolutionController proxy) public void SetProxy(StarEvolutionController proxy)
@ -183,7 +183,7 @@ namespace NewHorizons.Components.SizeControllers
base.FixedUpdate(); base.FixedUpdate();
// 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 = ageValue;