Fix supernova proxy rendering when it shouldnt

This commit is contained in:
Nick 2023-07-21 22:28:10 -04:00
parent be23f852fd
commit 6b27384a41
3 changed files with 17 additions and 3 deletions

View File

@ -5,6 +5,7 @@ using NewHorizons.Utility.OuterWilds;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace NewHorizons.Components
{
public class NHProxy : ProxyPlanet

View File

@ -364,7 +364,10 @@ namespace NewHorizons.Components.SizeControllers
_surface._materials[0].CopyPropertiesFromMaterial(_collapseStartSurfaceMaterial);
if (oneShotSource != null && !PlayerState.IsSleepingAtCampfire() && !PlayerState.InDreamWorld()) oneShotSource.PlayOneShot(AudioType.Sun_Collapse);
if (_proxy != null) _proxy.StartCollapse();
if (_proxy != null)
{
_proxy.StartCollapse();
}
}
public void StopCollapse()
@ -396,7 +399,14 @@ namespace NewHorizons.Components.SizeControllers
if (planetDestructionVolume != null) planetDestructionVolume._deathType = DeathType.Supernova;
if (oneShotSource != null && !PlayerState.IsSleepingAtCampfire() && !PlayerState.InDreamWorld()) oneShotSource.PlayOneShot(AudioType.Sun_Explosion);
if (_proxy != null) _proxy.StartSupernova();
if (_proxy != null)
{
_proxy.StartSupernova();
// When the supernova starts some effects start on, we have to refresh their states
var nhproxy = _proxy.GetComponentInParent<NHProxy>();
nhproxy.ToggleRendering(!nhproxy._outOfRange);
}
}
public void StopSupernova()

View File

@ -98,7 +98,10 @@ namespace NewHorizons.Components.Stars
public void SetParticlesVisibility(bool visible)
{
foreach (var particleRenderer in _cachedParticleRenderers) particleRenderer.enabled = visible;
foreach (var particleRenderer in _cachedParticleRenderers)
{
particleRenderer.enabled = visible;
}
}
public void SetRenderingEnabled(bool renderingEnabled)