Do black hole sound when you go in unpaired ones

This commit is contained in:
Nick 2023-07-19 22:18:22 -04:00
parent f2706eaf4d
commit b40247d0af
3 changed files with 20 additions and 4 deletions

View File

@ -197,7 +197,15 @@ namespace NewHorizons.Builder.Body
sphereCollider.isTrigger = true;
if (sizeController != null) sizeController.sphereCollider = sphereCollider;
if (hasDestructionVolume) destructionVolumeGO.AddComponent<BlackHoleDestructionVolume>();
var audio = destructionVolumeGO.AddComponent<AudioSource>();
audio.spatialBlend = 1f;
audio.maxDistance = distort * 2.5f;
destructionVolumeGO.AddComponent<OWAudioSource>();
if (hasDestructionVolume)
{
destructionVolumeGO.AddComponent<BlackHoleDestructionVolume>();
}
else if (targetStarSystem != null)
{
var wormholeVolume = destructionVolumeGO.AddComponent<BlackHoleWarpVolume>();

View File

@ -1,21 +1,28 @@
using NewHorizons.OtherMods.AchievementsPlus.NH;
using UnityEngine;
namespace NewHorizons.Components.Volumes
{
public class BlackHoleDestructionVolume : DestructionVolume
{
protected OWAudioSource _audio;
public override void Awake()
{
base.Awake();
_deathType = DeathType.BlackHole;
_audio = GetComponent<OWAudioSource>();
}
public override void VanishProbe(OWRigidbody probeBody, RelativeLocationData entryLocation)
{
SurveyorProbe requiredComponent = probeBody.GetRequiredComponent<SurveyorProbe>();
if (requiredComponent.IsLaunched())
var probe = probeBody.GetRequiredComponent<SurveyorProbe>();
_audio.PlayOneShot(AudioType.BH_BlackHoleEmission, 1f);
if (probe.IsLaunched())
{
Destroy(requiredComponent.gameObject);
Destroy(probe.gameObject);
ProbeLostAchievement.Earn();
}
}

View File

@ -17,6 +17,7 @@ namespace NewHorizons.Components.Volumes
public override void VanishPlayer(OWRigidbody playerBody, RelativeLocationData entryLocation)
{
Locator.GetPlayerAudioController().PlayOneShotInternal(AudioType.BH_BlackHoleEmission);
Main.Instance.ChangeCurrentStarSystem(TargetSolarSystem, PlayerState.AtFlightConsole());
}
}