Geyser volume

This commit is contained in:
TerrificTrifid 2022-08-10 13:39:27 -05:00
parent cc397f89fb
commit 17be25189d
2 changed files with 20 additions and 12 deletions

View File

@ -39,6 +39,7 @@ namespace NewHorizons.Builder.Props
if (info.disableBubbles) bubbles.SetActive(false); if (info.disableBubbles) bubbles.SetActive(false);
if (info.disableShaft) shaft.SetActive(false); if (info.disableShaft) shaft.SetActive(false);
if (info.disableSpout) spout.SetActive(false); if (info.disableSpout) spout.SetActive(false);
var geyserController = geyserGO.GetComponent<GeyserController>(); var geyserController = geyserGO.GetComponent<GeyserController>();
geyserController._activeDuration = info.activeDuration; geyserController._activeDuration = info.activeDuration;
geyserController._inactiveDuration = info.inactiveDuration; geyserController._inactiveDuration = info.inactiveDuration;
@ -66,19 +67,21 @@ namespace NewHorizons.Builder.Props
oneShotAudio.GetComponent<AudioSpreadController>().SetSector(sector); oneShotAudio.GetComponent<AudioSpreadController>().SetSector(sector);
loopAudio.GetComponent<AudioSpreadController>().SetSector(sector); loopAudio.GetComponent<AudioSpreadController>().SetSector(sector);
// Someone might want a geyser just for its force maybe idk Delay.FireOnNextUpdate(() => {
if (info.disableSpout & info.disableShaft & info.disableBubbles) if (info.volume == 0)
{ {
oneShotAudio.SetActive(false); oneShotAudio.SetActive(false);
loopAudio.SetActive(false); loopAudio.SetActive(false);
} }
// Disable start/end sounds if its just bubbles else
else if (info.disableSpout & info.disableShaft) {
{ oneShotAudio.GetComponent<OWAudioSource>().SetMaxVolume(info.volume);
oneShotAudio.SetActive(false); loopAudio.GetComponent<OWAudioSource>().SetMaxVolume(info.volume);
} }
});
// If it starts at the shaft, move the start/end sounds to it // If it starts at the shaft, move the start/end sounds to it
else if ((info.disableSpout & !info.disableShaft) | info.offset == -67f) if ((info.disableSpout & !info.disableShaft) | info.offset == -67f)
{ {
oneShotAudio.transform.SetLocalPositionY(67f); oneShotAudio.transform.SetLocalPositionY(67f);
} }

View File

@ -258,6 +258,11 @@ namespace NewHorizons.External.Modules
/// Disable the individual particle systems of the geyser /// Disable the individual particle systems of the geyser
/// </summary> /// </summary>
public bool disableBubbles, disableShaft, disableSpout; public bool disableBubbles, disableShaft, disableSpout;
/// <summary>
/// Loudness of the geyser
/// </summary>
[DefaultValue(0.7f)] public float volume = 0.7f;
} }
[JsonObject] [JsonObject]