Collapse and explosion sounds

This commit is contained in:
Noah Pilarski 2022-08-18 11:15:48 -04:00
parent 56dd69fdb6
commit 59e830a1f2
2 changed files with 5 additions and 0 deletions

View File

@ -168,6 +168,7 @@ namespace NewHorizons.Builder.Body
controller._destructionVolume = deathVolume.GetComponent<DestructionVolume>();
controller._planetDestructionVolume = planetDestructionVolume.GetComponent<StarDestructionVolume>();
controller._starFluidVolume = starFluidVolume;
controller._oneShotSource = sunAudio.transform.Find("OneShotAudio_Sun")?.GetComponent<OWAudioSource>();
starFluidVolume.SetStarEvolutionController(controller);
if (!string.IsNullOrEmpty(starModule.starCollapseRampTexture))
{

View File

@ -38,6 +38,8 @@ namespace NewHorizons.Components.SizeControllers
private MapMarker _mapMarker;
private OWRigidbody _rigidbody;
public OWAudioSource _oneShotSource;
private bool _isCollapsing;
private float _collapseStartSize;
private float _collapseTimer;
@ -297,6 +299,7 @@ namespace NewHorizons.Components.SizeControllers
_collapseStartSize = CurrentScale;
_collapseTimer = 0f;
supernova._surface._materials[0].CopyPropertiesFromMaterial(_collapseStartSurfaceMaterial);
if (_oneShotSource != null && !PlayerState.IsSleepingAtCampfire() && !PlayerState.InDreamWorld()) _oneShotSource.PlayOneShot(AudioType.Sun_Collapse);
if (_proxy != null) _proxy.StartCollapse();
}
@ -327,6 +330,7 @@ namespace NewHorizons.Components.SizeControllers
if (atmosphere != null) atmosphere.SetActive(false);
if (_destructionVolume != null) _destructionVolume._deathType = DeathType.Supernova;
if (_planetDestructionVolume != null) _planetDestructionVolume._deathType = DeathType.Supernova;
if (_oneShotSource != null && !PlayerState.IsSleepingAtCampfire() && !PlayerState.InDreamWorld()) _oneShotSource.PlayOneShot(AudioType.Sun_Explosion);
if (_proxy != null) _proxy.StartSupernova();
}