Add supernovaSize

This commit is contained in:
Noah Pilarski 2022-08-10 19:02:05 -04:00
parent 0f687d6481
commit 469c8d7444
3 changed files with 11 additions and 1 deletions

View File

@ -187,6 +187,7 @@ namespace NewHorizons.Builder.Body
var controller = starGO.AddComponent<StarEvolutionController>(); var controller = starGO.AddComponent<StarEvolutionController>();
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.supernovaSize = starModule.supernovaSize;
controller.supernova = supernova; controller.supernova = supernova;
controller.StartColour = starModule.tint; controller.StartColour = starModule.tint;
controller.EndColour = starModule.endTint; controller.EndColour = starModule.endTint;
@ -286,6 +287,7 @@ namespace NewHorizons.Builder.Body
var supernova = supernovaGO.GetComponent<SupernovaEffectController>(); var supernova = supernovaGO.GetComponent<SupernovaEffectController>();
supernova._surface = starGO.GetComponentInChildren<TessellatedSphereRenderer>(); supernova._surface = starGO.GetComponentInChildren<TessellatedSphereRenderer>();
supernova._supernovaScale = AnimationCurve.Linear(5, 0, 15, starModule.supernovaSize);
supernova._supernovaVolume = null; supernova._supernovaVolume = null;
if (starModule.supernovaTint != null) if (starModule.supernovaTint != null)

View File

@ -40,6 +40,7 @@ namespace NewHorizons.Components.SizeControllers
public float collapseTime = 10f; // seconds public float collapseTime = 10f; // seconds
public float lifespan = 22f; // minutes public float lifespan = 22f; // minutes
public float supernovaSize = 50000f;
private bool _isSupernova; private bool _isSupernova;
private float _supernovaStartTime; private float _supernovaStartTime;
@ -255,7 +256,7 @@ namespace NewHorizons.Components.SizeControllers
if (start && _planetDestructionVolume != null) if (start && _planetDestructionVolume != null)
{ {
foreach (var collider in Physics.OverlapSphere(_planetDestructionVolume.transform.position, _planetDestructionVolume.GetComponent<SphereCollider>().radius * 50000f * 0.9f)) foreach (var collider in Physics.OverlapSphere(_planetDestructionVolume.transform.position, _planetDestructionVolume.GetComponent<SphereCollider>().radius * supernovaSize * 0.9f))
{ {
if (collider.attachedRigidbody != null) if (collider.attachedRigidbody != null)
{ {

View File

@ -52,6 +52,13 @@ namespace NewHorizons.External.Modules.VariableSize
[DefaultValue(1f)] [Range(0f, double.MaxValue)] [DefaultValue(1f)] [Range(0f, double.MaxValue)]
public float solarLuminosity = 1f; public float solarLuminosity = 1f;
/// <summary>
/// Radius of the supernova.
/// </summary>
[DefaultValue(50000f)]
[Range(0f, double.MaxValue)]
public float supernovaSize = 50000f;
/// <summary> /// <summary>
/// The tint of the supernova this star creates when it dies. /// The tint of the supernova this star creates when it dies.
/// </summary> /// </summary>