mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Star collapse ramp texture and fix end color
This commit is contained in:
parent
2258dc3947
commit
3e99fb5bd8
@ -137,9 +137,19 @@ namespace NewHorizons.Builder.Body
|
||||
controller.size = starModule.size;
|
||||
controller.atmosphere = sunAtmosphere;
|
||||
controller.supernova = supernova;
|
||||
controller.StartColour = starModule.tint;
|
||||
controller.EndColour = starModule.endTint;
|
||||
controller.WillExplode = starModule.goSupernova;
|
||||
controller.startColour = starModule.tint?.ToColor();
|
||||
controller.endColour = starModule.tint != null ? starModule.tint.ToColor() * 4.5948f : null;
|
||||
controller.willExplode = starModule.goSupernova;
|
||||
if (!string.IsNullOrEmpty(starModule.starRampTexture))
|
||||
{
|
||||
var ramp = ImageUtilities.GetTexture(mod, starModule.starRampTexture);
|
||||
controller.normalRamp = ramp;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(starModule.starCollapseRampTexture))
|
||||
{
|
||||
var ramp = ImageUtilities.GetTexture(mod, starModule.starCollapseRampTexture);
|
||||
controller.collapseRamp = ramp;
|
||||
}
|
||||
surfaceAudio.SetStarEvolutionController(controller);
|
||||
starGO.SetActive(true);
|
||||
|
||||
@ -177,8 +187,8 @@ namespace NewHorizons.Builder.Body
|
||||
if (starModule.curve != null) controller.SetScaleCurve(starModule.curve);
|
||||
controller.size = starModule.size;
|
||||
controller.supernova = supernova;
|
||||
controller.StartColour = starModule.tint;
|
||||
controller.EndColour = starModule.endTint;
|
||||
controller.startColour = starModule.tint?.ToColor();
|
||||
controller.endColour = starModule.tint != null ? starModule.tint.ToColor() * 4.5948f : null;
|
||||
controller.enabled = true;
|
||||
starGO.SetActive(true);
|
||||
|
||||
|
||||
@ -15,9 +15,11 @@ namespace NewHorizons.Components.SizeControllers
|
||||
{
|
||||
public GameObject atmosphere;
|
||||
public SupernovaEffectController supernova;
|
||||
public bool WillExplode { get; set; }
|
||||
public MColor StartColour { get; set; }
|
||||
public MColor EndColour { get; set; }
|
||||
public bool willExplode;
|
||||
public Color? startColour;
|
||||
public Color? endColour;
|
||||
public Texture normalRamp;
|
||||
public Texture collapseRamp;
|
||||
|
||||
private Color _startColour;
|
||||
private Color _endColour;
|
||||
@ -43,6 +45,8 @@ namespace NewHorizons.Components.SizeControllers
|
||||
private Material _collapseEndSurfaceMaterial;
|
||||
private Material _startSurfaceMaterial;
|
||||
private Material _endSurfaceMaterial;
|
||||
private Texture _normalRamp;
|
||||
private Texture _collapseRamp;
|
||||
|
||||
private StarEvolutionController _proxy;
|
||||
|
||||
@ -60,31 +64,45 @@ namespace NewHorizons.Components.SizeControllers
|
||||
_endSurfaceMaterial = new Material(sun._endSurfaceMaterial);
|
||||
|
||||
var supernovaSurfaceColorRamp = supernova._surface.sharedMaterial.GetTexture(ColorRamp);
|
||||
if (normalRamp == null)
|
||||
{
|
||||
_normalRamp = supernovaSurfaceColorRamp;
|
||||
} else
|
||||
{
|
||||
_normalRamp = normalRamp;
|
||||
}
|
||||
if (collapseRamp == null)
|
||||
{
|
||||
_collapseRamp = supernovaSurfaceColorRamp;
|
||||
} else
|
||||
{
|
||||
_collapseRamp = collapseRamp;
|
||||
}
|
||||
|
||||
// Copy over the material that was set in star builder
|
||||
_collapseStartSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||
_collapseEndSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||
_startSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||
_endSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||
_collapseStartSurfaceMaterial.SetTexture(ColorRamp, _collapseRamp);
|
||||
_collapseEndSurfaceMaterial.SetTexture(ColorRamp, _collapseRamp);
|
||||
_startSurfaceMaterial.SetTexture(ColorRamp, _normalRamp);
|
||||
_endSurfaceMaterial.SetTexture(ColorRamp, _normalRamp);
|
||||
|
||||
if (StartColour == null)
|
||||
if (startColour == null)
|
||||
{
|
||||
_startColour = _startSurfaceMaterial.color;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startColour = StartColour.ToColor();
|
||||
_startColour = startColour.Value;
|
||||
_startSurfaceMaterial.color = _startColour;
|
||||
}
|
||||
|
||||
if (EndColour == null)
|
||||
if (endColour == null)
|
||||
{
|
||||
_endColour = _startColour;
|
||||
_endSurfaceMaterial.color = _startColour;
|
||||
}
|
||||
else
|
||||
{
|
||||
_endColour = EndColour.ToColor();
|
||||
_endColour = endColour.Value;
|
||||
_endSurfaceMaterial.color = _endColour;
|
||||
}
|
||||
|
||||
@ -97,7 +115,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
_atmosphereRenderers = atmosphere?.transform?.Find("AtmoSphere")?.GetComponentsInChildren<MeshRenderer>();
|
||||
}
|
||||
|
||||
if (WillExplode) GlobalMessenger.AddListener("TriggerSupernova", Die);
|
||||
if (willExplode) GlobalMessenger.AddListener("TriggerSupernova", Die);
|
||||
|
||||
if (scaleCurve != null)
|
||||
{
|
||||
@ -115,7 +133,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
if (WillExplode) GlobalMessenger.RemoveListener("TriggerSupernova", Die);
|
||||
if (willExplode) GlobalMessenger.RemoveListener("TriggerSupernova", Die);
|
||||
}
|
||||
|
||||
public void SetProxy(StarEvolutionController proxy)
|
||||
@ -165,12 +183,13 @@ namespace NewHorizons.Components.SizeControllers
|
||||
base.FixedUpdate();
|
||||
|
||||
// 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
|
||||
var t = ageValue;
|
||||
if (maxScale > 0) t = CurrentScale / maxScale;
|
||||
currentColour = Color.Lerp(_startColour, _endColour, t);
|
||||
supernova._surface._materials[0].SetTexture(ColorRamp, _normalRamp);
|
||||
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t);
|
||||
}
|
||||
else
|
||||
@ -190,6 +209,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
|
||||
currentColour = Color.Lerp(_endColour, Color.white, t);
|
||||
|
||||
supernova._surface._materials[0].SetTexture(ColorRamp, _collapseRamp);
|
||||
supernova._surface._materials[0].Lerp(_collapseStartSurfaceMaterial, _collapseEndSurfaceMaterial, t);
|
||||
|
||||
// After the collapse is done we go supernova
|
||||
|
||||
@ -61,6 +61,11 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
/// </summary>
|
||||
public string starRampTexture;
|
||||
|
||||
/// <summary>
|
||||
/// Path to the texture to put as the star ramp while it is collapsing. Optional.
|
||||
/// </summary>
|
||||
public string starCollapseRampTexture;
|
||||
|
||||
/// <summary>
|
||||
/// How far the light from the star can reach.
|
||||
/// </summary>
|
||||
|
||||
@ -1968,6 +1968,10 @@
|
||||
"type": "string",
|
||||
"description": "Path to the texture to put as the star ramp. Optional."
|
||||
},
|
||||
"starRampCollapseTexture": {
|
||||
"type": "string",
|
||||
"description": "Path to the texture to put as the star ramp while it is collapsing. Optional."
|
||||
},
|
||||
"lightRadius": {
|
||||
"type": "number",
|
||||
"description": "How far the light from the star can reach.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user