mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Organize stars more
This commit is contained in:
parent
37f59cfca3
commit
69b3e405f3
@ -116,7 +116,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
_atmosphereRenderers = atmosphere?.transform?.Find("AtmoSphere")?.GetComponentsInChildren<MeshRenderer>();
|
||||
}
|
||||
|
||||
if (WillExplode) GlobalMessenger.AddListener("TriggerSupernova", Die);
|
||||
if (WillExplode) GlobalMessenger.AddListener("TriggerSupernova", StartCollapse);
|
||||
|
||||
if (scaleCurve != null)
|
||||
{
|
||||
@ -134,7 +134,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
if (WillExplode) GlobalMessenger.RemoveListener("TriggerSupernova", Die);
|
||||
if (WillExplode) GlobalMessenger.RemoveListener("TriggerSupernova", StartCollapse);
|
||||
}
|
||||
|
||||
public void SetProxy(StarEvolutionController proxy)
|
||||
@ -143,32 +143,6 @@ namespace NewHorizons.Components.SizeControllers
|
||||
_proxy.supernova.SetIsProxy(true);
|
||||
}
|
||||
|
||||
public void Die()
|
||||
{
|
||||
_isCollapsing = true;
|
||||
_collapseStartSize = CurrentScale;
|
||||
_collapseTimer = 0f;
|
||||
supernova._surface._materials[0].CopyPropertiesFromMaterial(_collapseStartSurfaceMaterial);
|
||||
|
||||
if (_proxy != null) _proxy.Die();
|
||||
}
|
||||
|
||||
private void UpdateSupernova()
|
||||
{
|
||||
// Reset the scale back to normal bc now its just the supernova scaling itself + destruction and heat volumes
|
||||
transform.localScale = Vector3.one;
|
||||
|
||||
// Make the destruction volume scale slightly smaller so you really have to be in the supernova to die
|
||||
if (_destructionVolume != null) _destructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
|
||||
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
|
||||
|
||||
if (Time.time > _supernovaStartTime + 45f)
|
||||
{
|
||||
// Just turn off the star entirely
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateMainSequence()
|
||||
{
|
||||
var ageValue = _age / (lifespan * 60f);
|
||||
@ -203,8 +177,41 @@ namespace NewHorizons.Components.SizeControllers
|
||||
supernova._surface._materials[0].Lerp(_collapseStartSurfaceMaterial, _collapseEndSurfaceMaterial, t);
|
||||
|
||||
// After the collapse is done we go supernova
|
||||
if (_collapseTimer > collapseTime)
|
||||
if (_collapseTimer > collapseTime) StartSupernova();
|
||||
}
|
||||
|
||||
private void UpdateSupernova()
|
||||
{
|
||||
// Reset the scale back to normal bc now its just the supernova scaling itself + destruction and heat volumes
|
||||
transform.localScale = Vector3.one;
|
||||
|
||||
// Make the destruction volume scale slightly smaller so you really have to be in the supernova to die
|
||||
if (_destructionVolume != null) _destructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
|
||||
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
|
||||
|
||||
if (Time.time > _supernovaStartTime + 45f)
|
||||
{
|
||||
// Just turn off the star entirely
|
||||
base.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartCollapse()
|
||||
{
|
||||
Logger.LogVerbose($"{gameObject.transform.root.name} started collapse");
|
||||
|
||||
_isCollapsing = true;
|
||||
_collapseStartSize = CurrentScale;
|
||||
_collapseTimer = 0f;
|
||||
supernova._surface._materials[0].CopyPropertiesFromMaterial(_collapseStartSurfaceMaterial);
|
||||
|
||||
if (_proxy != null) _proxy.StartCollapse();
|
||||
}
|
||||
|
||||
private void StartSupernova()
|
||||
{
|
||||
Logger.LogVerbose($"{gameObject.transform.root.name} started supernova");
|
||||
|
||||
SupernovaStart.Invoke();
|
||||
supernova.enabled = true;
|
||||
_isSupernova = true;
|
||||
@ -212,7 +219,6 @@ namespace NewHorizons.Components.SizeControllers
|
||||
if (atmosphere != null) atmosphere.SetActive(false);
|
||||
if (_destructionVolume != null) _destructionVolume._deathType = DeathType.Supernova;
|
||||
}
|
||||
}
|
||||
|
||||
protected new void FixedUpdate()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user