diff --git a/NewHorizons/Builder/Body/SingularityBuilder.cs b/NewHorizons/Builder/Body/SingularityBuilder.cs index 99493304..ad94374e 100644 --- a/NewHorizons/Builder/Body/SingularityBuilder.cs +++ b/NewHorizons/Builder/Body/SingularityBuilder.cs @@ -175,6 +175,10 @@ namespace NewHorizons.Builder.Body var singularityAudioSource = singularityAmbience.GetComponent(); singularityAudioSource.maxDistance = distort * 2.5f; singularityAudioSource.minDistance = horizon; + + // Sounds really weird on large black holes but isn't noticeable on small ones. #226 + singularityAudioSource.dopplerLevel = 0; + singularityAmbience.transform.localPosition = Vector3.zero; if (sizeController != null) sizeController.audioSource = singularityAudioSource; @@ -193,7 +197,15 @@ namespace NewHorizons.Builder.Body sphereCollider.isTrigger = true; if (sizeController != null) sizeController.sphereCollider = sphereCollider; - if (hasDestructionVolume) destructionVolumeGO.AddComponent(); + var audio = destructionVolumeGO.AddComponent(); + audio.spatialBlend = 1f; + audio.maxDistance = distort * 2.5f; + destructionVolumeGO.AddComponent(); + + if (hasDestructionVolume) + { + destructionVolumeGO.AddComponent(); + } else if (targetStarSystem != null) { var wormholeVolume = destructionVolumeGO.AddComponent(); @@ -213,8 +225,19 @@ namespace NewHorizons.Builder.Body var blackHoleVolume = Object.Instantiate(_blackHoleVolume, singularity.transform); blackHoleVolume.name = "BlackHoleVolume"; - blackHoleVolume.SetActive(true); + + // Scale vanish effect to black hole size var bhVolume = blackHoleVolume.GetComponent(); + foreach (var ps in bhVolume._vanishEffectPrefab.GetComponentsInChildren()) + { +#pragma warning disable CS0618 // Type or member is obsolete - It tells you to use some readonly shit instead + ps.scalingMode = ParticleSystemScalingMode.Hierarchy; +#pragma warning restore CS0618 // Type or member is obsolete + } + bhVolume._vanishEffectPrefab.transform.localScale = Vector3.one * horizon / 100f; + + blackHoleVolume.SetActive(true); + bhVolume._audioSector = sector; bhVolume._emissionSource = oneShotOWAudioSource; var blackHoleSphereCollider = blackHoleVolume.GetComponent(); diff --git a/NewHorizons/Components/Volumes/BlackHoleDestructionVolume.cs b/NewHorizons/Components/Volumes/BlackHoleDestructionVolume.cs index e5489760..e264221b 100644 --- a/NewHorizons/Components/Volumes/BlackHoleDestructionVolume.cs +++ b/NewHorizons/Components/Volumes/BlackHoleDestructionVolume.cs @@ -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(); } public override void VanishProbe(OWRigidbody probeBody, RelativeLocationData entryLocation) { - SurveyorProbe requiredComponent = probeBody.GetRequiredComponent(); - if (requiredComponent.IsLaunched()) + var probe = probeBody.GetRequiredComponent(); + + _audio.PlayOneShot(AudioType.BH_BlackHoleEmission, 1f); + + if (probe.IsLaunched()) { - Destroy(requiredComponent.gameObject); + Destroy(probe.gameObject); ProbeLostAchievement.Earn(); } } diff --git a/NewHorizons/Components/Volumes/BlackHoleWarpVolume.cs b/NewHorizons/Components/Volumes/BlackHoleWarpVolume.cs index 58202aa1..bd99fee5 100644 --- a/NewHorizons/Components/Volumes/BlackHoleWarpVolume.cs +++ b/NewHorizons/Components/Volumes/BlackHoleWarpVolume.cs @@ -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()); } }