mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix star log errors
This commit is contained in:
parent
8c043c4ba0
commit
7b5e66b37c
@ -119,21 +119,24 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
var supernova = MakeSupernova(starGO, starModule);
|
var supernova = MakeSupernova(starGO, starModule);
|
||||||
|
|
||||||
|
starGO.SetActive(false);
|
||||||
var controller = starGO.AddComponent<StarEvolutionController>();
|
var controller = starGO.AddComponent<StarEvolutionController>();
|
||||||
if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve();
|
if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve();
|
||||||
controller.size = starModule.size;
|
controller.size = starModule.size;
|
||||||
controller.atmosphere = sunAtmosphere;
|
controller.atmosphere = sunAtmosphere;
|
||||||
controller.supernova = supernova;
|
controller.supernova = supernova;
|
||||||
controller.startColour = starModule.tint;
|
controller.StartColour = starModule.tint;
|
||||||
controller.endColour = starModule.endTint;
|
controller.EndColour = starModule.endTint;
|
||||||
controller.willExplode = starModule.goSupernova;
|
controller.WillExplode = starModule.goSupernova;
|
||||||
|
starGO.SetActive(true);
|
||||||
|
|
||||||
// It fucking insists on this existing and its really annoying
|
// It fucking insists on this existing and its really annoying
|
||||||
var supernovaVolume = new GameObject("SupernovaVolumePlaceholder");
|
var supernovaVolume = new GameObject("SupernovaVolumePlaceholder");
|
||||||
supernovaVolume.transform.SetParent(starGO.transform);
|
supernovaVolume.transform.SetParent(starGO.transform);
|
||||||
supernova._supernovaVolume = supernovaVolume.AddComponent<SupernovaDestructionVolume>();
|
supernova._supernovaVolume = supernovaVolume.AddComponent<SupernovaDestructionVolume>();
|
||||||
var sphere = supernovaVolume.AddComponent<SphereShape>();
|
var sphere = supernovaVolume.AddComponent<SphereCollider>();
|
||||||
sphere.radius = 0f;
|
sphere.radius = 0f;
|
||||||
|
sphere.isTrigger = true;
|
||||||
supernovaVolume.AddComponent<OWCollider>();
|
supernovaVolume.AddComponent<OWCollider>();
|
||||||
|
|
||||||
return starController;
|
return starController;
|
||||||
@ -145,13 +148,15 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
var supernova = MakeSupernova(starGO, starModule);
|
var supernova = MakeSupernova(starGO, starModule);
|
||||||
|
|
||||||
|
starGO.SetActive(false);
|
||||||
var controller = starGO.AddComponent<StarEvolutionController>();
|
var controller = starGO.AddComponent<StarEvolutionController>();
|
||||||
if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve();
|
if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve();
|
||||||
controller.size = starModule.size;
|
controller.size = starModule.size;
|
||||||
controller.supernova = supernova;
|
controller.supernova = supernova;
|
||||||
controller.startColour = starModule.tint;
|
controller.StartColour = starModule.tint;
|
||||||
controller.endColour = starModule.endTint;
|
controller.EndColour = starModule.endTint;
|
||||||
controller.enabled = true;
|
controller.enabled = true;
|
||||||
|
starGO.SetActive(true);
|
||||||
|
|
||||||
planet.GetComponentInChildren<StarEvolutionController>().SetProxy(controller);
|
planet.GetComponentInChildren<StarEvolutionController>().SetProxy(controller);
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.Builder.Body;
|
using NewHorizons.Builder.Body;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
namespace NewHorizons.Components.SizeControllers
|
namespace NewHorizons.Components.SizeControllers
|
||||||
{
|
{
|
||||||
@ -13,9 +14,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 MColor startColour { get; set; }
|
public MColor StartColour { get; set; }
|
||||||
public MColor endColour { get; set; }
|
public MColor EndColour { get; set; }
|
||||||
|
|
||||||
private Color _startColour;
|
private Color _startColour;
|
||||||
private Color _endColour;
|
private Color _endColour;
|
||||||
@ -44,6 +45,8 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
|
|
||||||
private StarEvolutionController _proxy;
|
private StarEvolutionController _proxy;
|
||||||
|
|
||||||
|
public UnityEvent SupernovaStart = new UnityEvent();
|
||||||
|
|
||||||
private float maxScale;
|
private float maxScale;
|
||||||
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
||||||
|
|
||||||
@ -61,24 +64,24 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
_startSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
_startSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
||||||
_endSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
_endSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
||||||
|
|
||||||
if (startColour == null)
|
if (StartColour == null)
|
||||||
{
|
{
|
||||||
_startColour = _startSurfaceMaterial.color;
|
_startColour = _startSurfaceMaterial.color;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_startColour = startColour;
|
_startColour = StartColour;
|
||||||
_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;
|
_endColour = EndColour;
|
||||||
_endSurfaceMaterial.color = _endColour;
|
_endSurfaceMaterial.color = _endColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,19 +94,25 @@ 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)
|
||||||
{
|
{
|
||||||
maxScale = scaleCurve.keys.Select(x => x.value).Max() * size;
|
maxScale = scaleCurve.keys.Select(x => x.value).Max() * size;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxScale = 0;
|
||||||
|
scaleCurve = new AnimationCurve();
|
||||||
|
scaleCurve.AddKey(0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
_flareEmitter = GetComponentInChildren<SolarFlareEmitter>();
|
_flareEmitter = GetComponentInChildren<SolarFlareEmitter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
@ -153,7 +162,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;
|
||||||
@ -183,6 +192,7 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
// After the collapse is done we go supernova
|
// After the collapse is done we go supernova
|
||||||
if (_collapseTimer > collapseTime)
|
if (_collapseTimer > collapseTime)
|
||||||
{
|
{
|
||||||
|
SupernovaStart.Invoke();
|
||||||
supernova.enabled = true;
|
supernova.enabled = true;
|
||||||
_isSupernova = true;
|
_isSupernova = true;
|
||||||
_supernovaStartTime = Time.time;
|
_supernovaStartTime = Time.time;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user